1.19.3 port

This commit is contained in:
Relentless 2023-02-04 16:18:29 +01:00
parent 5a55587ec0
commit 8db0f1d005
No known key found for this signature in database
GPG key ID: 50C5FD225130D790
25 changed files with 142 additions and 625 deletions

12
.github/stale.yml vendored
View file

@ -1,12 +0,0 @@
daysUntilStale: 14
daysUntilClose: 3
exemptLabels:
- "state: completed"
- "state: confirmed"
- "state: help wanted/needed"
- "state: in progress"
staleLabel: "type: abandoned"
markComment: >
This submission has been automatically marked as abandoned because it has not had recent activity. It will be closed in 3 days. If you want to prevent that, leave a new comment.
closeComment: >
Due to no recent activity, this submission is closed now.

View file

@ -4,12 +4,12 @@ on:
workflow_dispatch:
push:
branches:
- '1.19.2'
- '1.19.3'
tags-ignore:
- '**'
pull_request:
branches:
- '1.19.2'
- '1.19.3'
env:
JAVA_DIST: 'zulu'

View file

@ -4,7 +4,7 @@ on:
workflow_dispatch:
push:
tags:
- 'v1.19.2-*.*.*'
- 'v1.19.3-*.*.*'
env:
JAVA_DIST: 'zulu'
@ -107,10 +107,8 @@ jobs:
curseforge-dependencies: |
jei | suggests | *
roughly-enough-items | suggests | *
kubejs | suggests | *
modrinth-dependencies: |
roughly-enough-items | suggests | *
kubejs | suggests | *
retry-attempts: 2
retry-delay: 10000
@ -137,10 +135,8 @@ jobs:
curseforge-dependencies: |
jei | suggests | *
roughly-enough-items | suggests | *
kubejs | suggests | *
modrinth-dependencies: |
roughly-enough-items | suggests | *
kubejs | suggests | *
retry-attempts: 2
retry-delay: 10000

View file

@ -1,9 +0,0 @@
name: "Support Requests"
on:
issues:
types: [labeled, unlabeled, reopened]
jobs:
support-requests:
uses: AlmostReliable/.github/.github/workflows/support.yml@main

View file

@ -5,284 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].
## [0.3.4] - 2023-02-01
## [0.3.4] - 2023-02-04
### Added
- lookup API for mod developers to integrate Almost Unified into their mod
## [0.3.3] - 2022-12-20
### Added
- German translation
- proper Fabric default mod priorities
- missing default tags for Fabric
### Removed
- Forge styled tags from Fabric defaults
### Changed
- improved tooltip information
## [0.3.2] - 2022-12-05
### WARNING
This update will reset your `duplicates.json` config because of a new option. It is automatically backed up as `duplicates.json.bak` inside the same folder.
Please make sure to apply your custom settings again.
### Added
- config option to sanitize recipe JSONs
### Changed
- improved duplicate checks for recipes with implicit counts of 1
## [0.3.0] - 2022-11-30
### Added
- support for Ad Astra! ([#24])
### Changed
- REI on Forge now uses a native plugin instead of the compat layer ([#26])
### Fixed
- automatic item hiding with REI ([#26])
- this bumps the minimum REI version to 9.1.574
- Immersive Engineering Arc Furnace Slag not being unified ([#25])
- some Mekanism recipes not being completely unified
<!-- Links -->
[#24]: https://github.com/AlmostReliable/almostunified/pull/24
[#25]: https://github.com/AlmostReliable/almostunified/issues/25
[#26]: https://github.com/AlmostReliable/almostunified/pull/26
## [0.2.6] - 2022-11-21
### Removed
- stone strata exclusions for recipe ingredients introduced in [#22]
- it introduced some unwanted edge cases
- this won't break any previous recipes
<!-- Links -->
[#22]: https://github.com/AlmostReliable/almostunified/issues/22
## [0.2.5] - 2022-11-21
### Added
- a way to obtain the `unify.json` config and the material list from the KubeJS binding
### Fixed
- hiding of tags that only consisted of items with the same namespace ([#21])
- stone strata detection not being applied to ingredients ([#22])
- inconsistency in recipe duplication removal and dumps ([#23])
<!-- Links -->
[#21]: https://github.com/AlmostReliable/almostunified/issues/21
[#22]: https://github.com/AlmostReliable/almostunified/issues/22
[#23]: https://github.com/AlmostReliable/almostunified/issues/23
## [0.2.3] - 2022-11-07
### Info
This update brings back compatibility for JEI 9 and therefor fixes incompatibility with REI on Minecraft Forge.
### Added
- portuguese translation ([#18])
### Changed
- improved the placement for the recipe indicator icon in JEI
### Fixed
- misaligned tooltips in JEI
<!-- Links -->
[#18]: https://github.com/AlmostReliable/almostunified/pull/18
## [0.2.2] - 2022-11-01
### Added
- config option to completely ignore items from unification and hiding
### Changed
- improved stone strata detection by making use of `forge:ores_in_ground` tag
- this also allows pack devs to fix stone stratas for mods that don't support it yet
## [0.2.1] - 2022-10-28
### Added
- config backup system
- when your config has invalid entries, it will be backed up and a new config will be generated
- the new config will try to apply as many of the old settings as possible
- new backups will overwrite old backups
- proper ingredient hiding for REI
- hidden ingredients will no longer show up in recipes
- this bumps the minimum REI version to 9.1.558
### Changed
- tag priority overrides now use `ResourceLocation`s internally to automatically validate config entries
## [0.2.0] - 2022-10-19
### Added
- priority overrides
- allows to define a priority mod for a specific tag
- the new option is automatically added to the `unify.json` config on the next run and is empty by default
### Fixed
- recipe indicator tooltip on lower resolutions exceeding the screen
## [0.1.2] - 2022-10-17
### Info
This is the initial port for 1.19.2 and KubeJS v6. Older versions are not supported anymore.
### Added
- Amethyst Imbuement recipe compat ([#13])
<!-- Links -->
[#13]: https://github.com/AlmostReliable/almostunified/issues/13
## [0.1.1] - 2022-09-27
### Added
- server only mode ([#9], [#11])
- on startup, there will be a `startup.json` config to activate it
<!-- Links -->
[#9]: https://github.com/AlmostReliable/almostunified/issues/9
[#11]: https://github.com/AlmostReliable/almostunified/pull/11
## [0.1.0] - 2022-09-24
### WARNING
This release removes the modification of recipe IDs! If you modify any recipes which were unified already and make use of the recipe ID that uses `almostunified` as the namespace, make sure to fix it.
### Changed
- recipe modifications are now visible in JEI/REI by a little icon ([#8])
- this was previously only visible via the recipe ID (now removed)
- ensures that modified recipes which cause issues are not reported to the original authors
- recipe modifications now have less priority
- allows to cover more mods that directly inject recipes into the recipe manager
- still runs before the `recipes` event of KubeJS
### Removed
- recipe ID modifications ([#4], [#8])
### Fixed
- guide books showing errors because of modified recipe IDs ([#4], [#8])
<!-- Links -->
[#4]: https://github.com/AlmostReliable/almostunified/issues/4
[#8]: https://github.com/AlmostReliable/almostunified/pull/8
## [0.0.8] - 2022-09-17
### Added
- `wires/{material}` tag to defaults
- back up your `unify.json` config and let it regenerate to get the new defaults or add them yourself
### Fixed
- unnecessary handling of many duplicate links
- a typo in the log messages
- spaces in shaped recipe patterns not being handled correctly
## [0.0.7] - 2022-09-16
### Added
- more materials and `storage_blocks/raw_{material}` tag to defaults
- back up your `unify.json` config and let it regenerate to get the new defaults or add them yourself
- `fabric:conditions` to default duplicate ignore list
### Changed
- ignore lists in `unify.json` and `duplicates.json` now support regular expressions
- default configs are now more platform specific
### Fixed
- a compat issue on Fabric when REI is present
- items being hidden when they are the only entry in a tag
## [0.0.6] - 2022-09-02
### Added
- more materials to defaults
- back up your `unify.json` config and let it regenerate to get the new defaults or add them yourself
### Fixed
- stone strata detection for mods not following convention
## [0.0.5] - 2022-09-02
### Added
- `group` property to default ignored list
- this ensures that crafting recipes with specific recipe book categories are correctly unified
- back up your `duplicates.json` config and let it regenerate to get the new defaults or add them yourself
- `inputItems` and `outputItems` property to top level property scanning
- allows unification for mods like `FTBIC`
### Fixed
- duplication matching for crafting recipes with a `group` property
## [0.0.4] - 2022-08-25
### Added
- Cucumber `shaped_tag` recipe type to default ignored types
- if you are using Mystical Agriculture or other mods that require Cucumber, make the config change described [here][cucumber-shapedtag]
### Fixed
- shaped crafting recipe pattern matching ([#2])
- previously shaped recipes were checked for exact equality after the unification
- this caused issues with recipes using different definition keys for their patterns
- this change requires a config adjustment described [here][pattern-matching]
<!-- Links -->
[#2]: https://github.com/AlmostReliable/almostunified/pull/2
[cucumber-shapedtag]: https://github.com/AlmostReliable/almostunified/wiki/Mod-Support#mystial-agriculture-cucumber
[pattern-matching]: https://github.com/AlmostReliable/almostunified/wiki/FAQ#why-are-shaped-crafting-recipes-not-unified
## [0.0.3] - 2022-08-24
### Changed
- all unified recipes are now using the Almost Unified namespace ([#1])
- previously, only the duplicate recipes were modified to use the namespace
- this ensures that modified recipes are easily identified and not reported to other mod authors
<!-- Links -->
[#1]: https://github.com/AlmostReliable/almostunified/pull/1
## [0.0.2] - 2022-08-23
### Added
- strict mode for recipe duplication removal
### Fixed
- recipe duplication error spam
## [0.0.1] - 2022-08-23
Initial 1.19 release!
Initial 1.19.3 release!
<!-- Links -->
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html
<!-- Versions -->
[0.3.4]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.3.4-beta
[0.3.3]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.3.3-beta
[0.3.2]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.3.2-beta
[0.3.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.3.0-beta
[0.2.6]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.6-beta
[0.2.5]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.5-beta
[0.2.4]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.4-beta
[0.2.3]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.3-beta
[0.2.2]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.2-beta
[0.2.1]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.1-beta
[0.2.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.2.0-beta
[0.1.2]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.1.2-beta
[0.1.1]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.1.1-beta
[0.1.0]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.1.0-beta
[0.0.8]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.8-beta
[0.0.7]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.7-beta
[0.0.6]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.6-beta
[0.0.5]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.5-beta
[0.0.4]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.4-beta
[0.0.3]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.3-beta
[0.0.2]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.2-beta
[0.0.1]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19-0.0.1-beta
[0.3.4]: https://github.com/AlmostReliable/almostunified/releases/tag/v1.19.3-0.3.4-beta

View file

@ -5,7 +5,6 @@ val modName: String by project
val modPackage: String by project
val reiVersion: String by project
val jeiVersion: String by project
val kubejsVersion: String by project
val mappingsChannel: String by project
val mappingsVersion: String by project
val junitVersion: String by project
@ -27,11 +26,11 @@ loom {
}
dependencies {
modCompileOnly("dev.latvian.mods:kubejs:$kubejsVersion") // required for common kubejs plugin | common has remapping issues
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api:$reiVersion") // required for common rei plugin
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer on jei plugin
testCompileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // don't question this, it's required for compiling
modCompileOnly("mezz.jei:jei-$minecraftVersion-common:$jeiVersion") // required for common jei plugin and mixin
modCompileOnlyApi("mezz.jei:jei-$minecraftVersion-common:$jeiVersion") // required for common jei plugin
modCompileOnly("mezz.jei:jei-$minecraftVersion-gui:$jeiVersion") // required for jei mixin
// The Fabric loader is required here to use the @Environment annotations and to get the mixin dependencies.
// Do NOT use other classes from the Fabric loader!

View file

@ -3,7 +3,8 @@ package com.almostreliable.unified;
import com.almostreliable.unified.api.AlmostUnifiedLookup;
import com.almostreliable.unified.utils.UnifyTag;
import com.google.auto.service.AutoService;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
@ -24,9 +25,9 @@ public class AlmostUnifiedLookupImpl implements AlmostUnifiedLookup {
@Nullable
@Override
public Item getReplacementForItem(ItemLike itemLike) {
ResourceLocation id = Registry.ITEM.getKey(itemLike.asItem());
ResourceLocation id = BuiltInRegistries.ITEM.getKey(itemLike.asItem());
ResourceLocation result = AlmostUnified.getRuntime().getReplacementMap().getReplacementForItem(id);
return Registry.ITEM.getOptional(result).orElse(null);
return BuiltInRegistries.ITEM.getOptional(result).orElse(null);
}
@Nullable
@ -37,18 +38,18 @@ public class AlmostUnifiedLookupImpl implements AlmostUnifiedLookup {
.getRuntime()
.getReplacementMap()
.getPreferredItemForTag(asUnifyTag, $ -> true);
return Registry.ITEM.getOptional(result).orElse(null);
return BuiltInRegistries.ITEM.getOptional(result).orElse(null);
}
@Nullable
@Override
public TagKey<Item> getPreferredTagForItem(ItemLike itemLike) {
ResourceLocation id = Registry.ITEM.getKey(itemLike.asItem());
ResourceLocation id = BuiltInRegistries.ITEM.getKey(itemLike.asItem());
UnifyTag<Item> unifyTag = AlmostUnified.getRuntime().getReplacementMap().getPreferredTagForItem(id);
if (unifyTag == null) {
return null;
}
return TagKey.create(Registry.ITEM_REGISTRY, unifyTag.location());
return TagKey.create(Registries.ITEM, unifyTag.location());
}
@Override
@ -59,7 +60,7 @@ public class AlmostUnifiedLookupImpl implements AlmostUnifiedLookup {
.getFilteredTagMap()
.getItems(asUnifyTag)
.stream()
.flatMap(rl -> Registry.ITEM.getOptional(rl).stream())
.flatMap(rl -> BuiltInRegistries.ITEM.getOptional(rl).stream())
.collect(Collectors.toSet());
}
@ -70,7 +71,7 @@ public class AlmostUnifiedLookupImpl implements AlmostUnifiedLookup {
.getFilteredTagMap()
.getTags()
.stream()
.map(ut -> TagKey.create(Registry.ITEM_REGISTRY, ut.location()))
.map(ut -> TagKey.create(Registries.ITEM, ut.location()))
.collect(Collectors.toSet());
}
}

View file

@ -1,88 +0,0 @@
package com.almostreliable.unified.compat;
import com.almostreliable.unified.AlmostUnified;
import com.almostreliable.unified.BuildConfig;
import com.almostreliable.unified.config.UnifyConfig;
import com.almostreliable.unified.utils.UnifyTag;
import dev.latvian.mods.kubejs.KubeJSPlugin;
import dev.latvian.mods.kubejs.item.ItemStackJS;
import dev.latvian.mods.kubejs.script.BindingsEvent;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import javax.annotation.Nullable;
import java.util.Set;
import java.util.stream.Collectors;
public class AlmostKube extends KubeJSPlugin {
@Override
public void registerBindings(BindingsEvent event) {
if (event.getType().isServer()) {
event.add(BuildConfig.MOD_NAME, UnifyWrapper.class);
}
}
public static class UnifyWrapper {
@Nullable
public static String getPreferredTagForItem(ItemStack stack) {
UnifyTag<Item> tag = AlmostUnified
.getRuntime()
.getReplacementMap()
.getPreferredTagForItem(getId(stack));
return tag == null ? null : tag.location().toString();
}
public static ItemStack getReplacementForItem(ItemStack stack) {
ResourceLocation replacement = AlmostUnified
.getRuntime()
.getReplacementMap()
.getReplacementForItem(getId(stack));
return ItemStackJS.of(replacement);
}
public static ItemStack getPreferredItemForTag(ResourceLocation tag) {
UnifyTag<Item> asUnifyTag = UnifyTag.item(tag);
ResourceLocation item = AlmostUnified
.getRuntime()
.getReplacementMap()
.getPreferredItemForTag(asUnifyTag, $ -> true);
return ItemStackJS.of(item);
}
public static Set<String> getTags() {
return AlmostUnified
.getRuntime()
.getFilteredTagMap()
.getTags()
.stream()
.map(tag -> tag.location().toString())
.collect(Collectors.toSet());
}
public static Set<String> getItemIds(ResourceLocation tag) {
UnifyTag<Item> asUnifyTag = UnifyTag.item(tag);
return AlmostUnified
.getRuntime()
.getFilteredTagMap()
.getItems(asUnifyTag)
.stream()
.map(ResourceLocation::toString)
.collect(Collectors.toSet());
}
public static UnifyConfig getUnifyConfig() {
return AlmostUnified.getRuntime().getUnifyConfig();
}
private static ResourceLocation getId(ItemStack stack) {
return Registry.ITEM
.getResourceKey(stack.getItem())
.map(ResourceKey::location)
.orElseThrow(() -> new IllegalArgumentException("Item not found in registry"));
}
}
}

View file

@ -7,7 +7,7 @@ import com.almostreliable.unified.config.UnifyConfig;
import com.almostreliable.unified.utils.ReplacementMap;
import com.almostreliable.unified.utils.TagMap;
import com.almostreliable.unified.utils.UnifyTag;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
@ -45,7 +45,7 @@ public class HideHelper {
toHide);
}
return toHide.stream().flatMap(rl -> Registry.ITEM.getOptional(rl).stream()).map(ItemStack::new).toList();
return toHide.stream().flatMap(rl -> BuiltInRegistries.ITEM.getOptional(rl).stream()).map(ItemStack::new).toList();
}).flatMap(Collection::stream).toList();
}

View file

@ -1,54 +0,0 @@
package com.almostreliable.unified.mixin;
import com.almostreliable.unified.compat.AlmostJEI;
import com.almostreliable.unified.compat.RecipeIndicator;
import com.mojang.blaze3d.vertex.PoseStack;
import mezz.jei.api.gui.drawable.IDrawable;
import mezz.jei.api.recipe.category.IRecipeCategory;
import mezz.jei.common.gui.recipes.layout.RecipeLayout;
import mezz.jei.common.gui.recipes.layout.RecipeTransferButton;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import javax.annotation.Nullable;
@Mixin(RecipeLayout.class)
public abstract class JeiRecipeLayoutMixin<R> {
@Shadow(remap = false) @Final
private IRecipeCategory<R> recipeCategory;
@Shadow(remap = false) @Final
private R recipe;
@Shadow(remap = false) @Final
@Nullable private RecipeTransferButton recipeTransferButton;
@Unique
private boolean handled;
@Inject(method = "drawRecipe", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V", ordinal = 1), locals = LocalCapture.CAPTURE_FAILHARD)
private void unified$drawCornerIndicator(PoseStack stack, int mouseX, int mouseY, CallbackInfo ci, IDrawable background, int mX, int mY, IDrawable categoryBackground, int x, int y) {
if (recipeTransferButton != null && recipeTransferButton.visible) return;
var posX = x - RecipeIndicator.RENDER_SIZE;
var posY = y - RecipeIndicator.RENDER_SIZE;
AlmostJEI.handleIndicator(stack, mX, mY, posX, posY, recipeCategory, recipe);
handled = true;
}
@Inject(method = "drawRecipe", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getInstance()Lnet/minecraft/client/Minecraft;"))
private void unified$drawButtonIndicator(PoseStack stack, int mouseX, int mouseY, CallbackInfo ci) {
assert recipeTransferButton != null;
if (handled) {
handled = false;
return;
}
var posX = recipeTransferButton.x + (RecipeTransferButton.RECIPE_BUTTON_SIZE - RecipeIndicator.RENDER_SIZE) / 2;
var posY = recipeTransferButton.y - RecipeIndicator.RENDER_SIZE - 2;
AlmostJEI.handleIndicator(stack, mouseX, mouseY, posX, posY, recipeCategory, recipe);
}
}

View file

@ -0,0 +1,84 @@
package com.almostreliable.unified.mixin;
import com.almostreliable.unified.compat.AlmostJEI;
import com.almostreliable.unified.compat.RecipeIndicator;
import com.almostreliable.unified.utils.Utils;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import mezz.jei.api.gui.IRecipeLayoutDrawable;
import mezz.jei.common.util.ImmutableRect2i;
import mezz.jei.gui.recipes.RecipeTransferButton;
import mezz.jei.gui.recipes.RecipesGui;
import net.minecraft.client.renderer.Rect2i;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
@Mixin(RecipesGui.class)
public abstract class JeiRecipesGuiMixin {
private static final int BORDER_PADDING = 2;
@Shadow(remap = false) @Final
private List<RecipeTransferButton> recipeTransferButtons;
@Inject(
method = "drawLayouts",
at = @At(value = "INVOKE", target = "Lmezz/jei/api/gui/IRecipeLayoutDrawable;drawRecipe(Lcom/mojang/blaze3d/vertex/PoseStack;II)V", shift = At.Shift.AFTER),
locals = LocalCapture.CAPTURE_FAILHARD,
remap = false
)
private void unified$drawIndicator(
PoseStack poseStack, int mX, int mY, CallbackInfoReturnable<Optional<IRecipeLayoutDrawable<?>>> cir,
IRecipeLayoutDrawable<?> hoveredLayout, Iterator<?> i, IRecipeLayoutDrawable<?> recipeLayout
) {
RenderSystem.disableBlend();
RenderSystem.disableDepthTest();
var buttonArea = recipeLayout.getRecipeTransferButtonArea();
RecipeTransferButton transferButton = null;
for (var button : recipeTransferButtons) {
if (!button.visible || !buttonsMatch(buttonArea, button.getArea())) continue;
transferButton = button;
}
int posX;
int posY;
if (transferButton == null) {
var layoutArea = recipeLayout.getRect();
posX = layoutArea.getX() + layoutArea.getWidth() - RecipeIndicator.RENDER_SIZE / 2;
posY = layoutArea.getY() + layoutArea.getHeight() - RecipeIndicator.RENDER_SIZE / 2 + BORDER_PADDING;
} else {
posX = buttonArea.getX() + BORDER_PADDING;
posY = buttonArea.getY() - RecipeIndicator.RENDER_SIZE - 2 + BORDER_PADDING;
}
AlmostJEI.handleIndicator(
poseStack,
mX,
mY,
posX,
posY,
Utils.cast(recipeLayout.getRecipeCategory()),
recipeLayout.getRecipe()
);
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
}
private static boolean buttonsMatch(Rect2i a, ImmutableRect2i b) {
return a.getX() == b.getX() &&
a.getY() == b.getY() &&
a.getWidth() == b.getWidth() &&
a.getHeight() == b.getHeight();
}
}

View file

@ -5,6 +5,7 @@ import net.minecraft.commands.Commands;
import net.minecraft.core.RegistryAccess;
import net.minecraft.server.ReloadableServerResources;
import net.minecraft.tags.TagManager;
import net.minecraft.world.flag.FeatureFlagSet;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@ -18,7 +19,7 @@ public class ReloadableServerResourcesMixin {
@Shadow @Final private TagManager tagManager;
@Inject(method = "<init>", at = @At("RETURN"))
private void yoinkServerResources(RegistryAccess.Frozen frozen, Commands.CommandSelection commandSelection, int i, CallbackInfo ci) {
private void yoinkServerResources(RegistryAccess.Frozen frozen, FeatureFlagSet featureFlagSet, Commands.CommandSelection commandSelection, int i, CallbackInfo ci) {
AlmostUnified.updateTagManager(tagManager);
}
}

View file

@ -1,7 +1,8 @@
package com.almostreliable.unified.utils;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
@ -21,9 +22,9 @@ public class TagMap {
TagMap tagMap = new TagMap();
unifyTags.forEach(ut -> {
TagKey<Item> asTagKey = TagKey.create(Registry.ITEM_REGISTRY, ut.location());
Registry.ITEM.getTagOrEmpty(asTagKey).forEach(holder -> {
ResourceLocation key = Registry.ITEM.getKey(holder.value());
TagKey<Item> asTagKey = TagKey.create(Registries.ITEM, ut.location());
BuiltInRegistries.ITEM.getTagOrEmpty(asTagKey).forEach(holder -> {
ResourceLocation key = BuiltInRegistries.ITEM.getKey(holder.value());
tagMap.put(ut, key);
});
});
@ -42,7 +43,7 @@ public class TagMap {
var tags = tagManager
.getResult()
.stream()
.filter(result -> result.key() == Registry.ITEM_REGISTRY)
.filter(result -> result.key() == Registries.ITEM)
.findFirst()
.map(TagManager.LoadResult::tags)
.orElseThrow(() -> new IllegalStateException("No item tag result found"));
@ -56,7 +57,7 @@ public class TagMap {
holder
.unwrapKey()
.map(ResourceKey::location)
.filter(Registry.ITEM::containsKey)
.filter(BuiltInRegistries.ITEM::containsKey)
.ifPresent(itemId -> tagMap.put(tag, itemId));
}
}

View file

@ -52,7 +52,7 @@ public final class Utils {
List<FormattedCharSequence> formattedTooltip = new ArrayList<>(tooltip.size());
for (Component line : tooltip) {
formattedTooltip.addAll(ComponentRenderUtils.wrapComponents(line, 150, mc.font));
formattedTooltip.addAll(ComponentRenderUtils.wrapComponents(line, 300, mc.font));
}
screen.renderTooltip(stack, formattedTooltip, mX, mY);
}

View file

@ -1,15 +1,18 @@
{
"required": true,
"minVersion": "0.8.5",
"package": "com.almostreliable.unified.mixin",
"compatibilityLevel": "JAVA_17",
"plugin": "com.almostreliable.unified.mixin.AlmostMixinPlugin",
"mixins": [
"RecipeManagerMixin",
"ReloadableServerResourcesMixin"
],
"client": ["ClientPacketListenerMixin", "JeiRecipeLayoutMixin"],
"injectors": {
"defaultRequire": 1
}
"required": true,
"minVersion": "0.8.5",
"package": "com.almostreliable.unified.mixin",
"compatibilityLevel": "JAVA_17",
"plugin": "com.almostreliable.unified.mixin.AlmostMixinPlugin",
"mixins": [
"RecipeManagerMixin",
"ReloadableServerResourcesMixin"
],
"client": [
"ClientPacketListenerMixin",
"JeiRecipesGuiMixin"
],
"injectors": {
"defaultRequire": 1
}
}

View file

@ -1 +0,0 @@
com.almostreliable.unified.compat.AlmostKube

View file

@ -4,7 +4,6 @@ val fabricApiVersion: String by project
val fabricRecipeViewer: String by project
val reiVersion: String by project
val jeiVersion: String by project
val kubejsVersion: String by project
plugins {
id("com.github.johnrengelman.shadow") version ("7.1.2")
@ -31,7 +30,6 @@ dependencies {
common(project(":Common", "namedElements")) { isTransitive = false }
shadowCommon(project(":Common", "transformProductionFabric")) { isTransitive = false }
modCompileOnly(modLocalRuntime("dev.latvian.mods:kubejs-fabric:$kubejsVersion")!!)
modCompileOnly("me.shedaniel:RoughlyEnoughItems-api-fabric:$reiVersion") // required for common rei plugin
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer on jei plugin
testCompileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // don't question this, it's required for compiling

View file

@ -3,14 +3,15 @@ package com.almostreliable.unified;
import com.almostreliable.unified.recipe.ClientRecipeTracker;
import net.fabricmc.api.ModInitializer;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
public class AlmostUnifiedFabric implements ModInitializer {
@Override
public void onInitialize() {
if (!AlmostUnified.getStartupConfig().isServerOnly()) {
Registry.register(Registry.RECIPE_SERIALIZER, ClientRecipeTracker.ID, ClientRecipeTracker.SERIALIZER);
Registry.register(Registry.RECIPE_TYPE, ClientRecipeTracker.ID, ClientRecipeTracker.TYPE);
Registry.register(BuiltInRegistries.RECIPE_SERIALIZER, ClientRecipeTracker.ID, ClientRecipeTracker.SERIALIZER);
Registry.register(BuiltInRegistries.RECIPE_TYPE, ClientRecipeTracker.ID, ClientRecipeTracker.TYPE);
}
}
}

View file

@ -34,7 +34,6 @@
"java": ">=17"
},
"suggests": {
"roughlyenoughitems": ">=${reiVersion}",
"kubejs": ">=${kubejsVersion}"
"roughlyenoughitems": ">=${reiVersion}"
}
}

View file

@ -5,7 +5,6 @@ val modId: String by project
val forgeRecipeViewer: String by project
val reiVersion: String by project
val jeiVersion: String by project
val kubejsVersion: String by project
plugins {
@ -42,7 +41,6 @@ dependencies {
shadowCommon(project(":Common", "transformProductionForge")) { isTransitive = false }
// Mod dependencies
modCompileOnly(modLocalRuntime("dev.latvian.mods:kubejs-forge:$kubejsVersion")!!)
modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:$reiVersion") // required for common rei plugin | api does not work here
compileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // required to disable rei compat layer on jei plugin
testCompileOnly("me.shedaniel:REIPluginCompatibilities-forge-annotations:9.+") // don't question this, it's required for compiling

View file

@ -1,7 +1,7 @@
package com.almostreliable.unified;
import com.almostreliable.unified.recipe.ClientRecipeTracker;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.ForgeRegistries;
@ -14,10 +14,10 @@ public class AlmostUnifiedForge {
if (!AlmostUnified.getStartupConfig().isServerOnly()) {
var modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
modEventBus.addListener((RegisterEvent event) -> {
if (event.getRegistryKey().equals(Registry.RECIPE_SERIALIZER_REGISTRY)) {
if (event.getRegistryKey().equals(Registries.RECIPE_SERIALIZER)) {
ForgeRegistries.RECIPE_SERIALIZERS.register(ClientRecipeTracker.ID, ClientRecipeTracker.SERIALIZER);
}
if (event.getRegistryKey().equals(Registry.RECIPE_TYPE_REGISTRY)) {
if (event.getRegistryKey().equals(Registries.RECIPE_TYPE)) {
ForgeRegistries.RECIPE_TYPES.register(ClientRecipeTracker.ID, ClientRecipeTracker.TYPE);
}
});

View file

@ -38,10 +38,3 @@ mandatory = false
versionRange = "[9.0.43,)"
ordering = "BEFORE"
side = "BOTH"
[[dependencies.${modId}]]
modId = "kubejs"
mandatory = false
versionRange = "[${kubejsVersion},)"
ordering = "BEFORE"
side = "BOTH"

117
README.md
View file

@ -1,117 +0,0 @@
<h1 align="center">
<a href="https://github.com/AlmostReliable/almostunified"><img src=https://i.imgur.com/3b7Gjkn.png" alt="Preview" width=200></a>
<p>Almost Unified</p>
</h1>
<div align="center">
A [Minecraft] mod to unify resources.
[![Version][version_badge]][version_link]
[![Total Downloads CF][total_downloads_cf_badge]][curseforge]
[![Total Downloads MR][total_downloads_mr_badge]][modrinth]
[![Workflow Status][workflow_status_badge]][workflow_status_link]
[![License][license_badge]][license]
[Discord] | [Wiki] | [CurseForge] | [Modrinth]
</div>
## **📖 Wiki**
For an in-depth explanation of the mod, its functionality, config descriptions, FAQs and more, check out the [wiki].
## **🔧 Manual Installation**
1. Download the latest **mod jar** from the [releases], from [CurseForge] or [Modrinth].
2. Install Minecraft [Forge] or [Fabric].
3. Drop the **jar file** into your mods folder.
## **🔗 Depending on the Mod**
### Maven
Every release of this project is built and published to the [BlameJared] maven.
```groovy
repositories {
maven {
url = 'https://maven.blamejared.com'
name = 'BlameJared Maven'
}
}
```
### Common [![Maven][maven_common_badge]][maven_common_link]
```groovy
dependencies {
modApi("com.almostreliable.mods:almostunified-common:<version>")
}
```
### Fabric [![Maven][maven_fabric_badge]][maven_fabric_link]
```groovy
dependencies {
modApi("com.almostreliable.mods:almostunified-fabric:<version>")
}
```
### Forge [![Maven][maven_forge_badge]][maven_forge_link]
```groovy
dependencies {
modApi(fg.deobf("com.almostreliable.mods:almostunified-forge:<version>"))
}
```
### Examples
For code examples on how to use the API, check out the [wiki][api-wiki].
## **🖥️ Dev Environment Setup**
1. Clone the repository
2. Import into IntelliJ (VSCode and Eclipse are not tested)
3. Run
- `gradle -> common -> Tasks -> fabric -> genSources`
- `gradle -> fabric -> Tasks -> fabric -> genSources`
- `gradle -> forge -> Tasks -> loom -> genSources`
- `gradle -> Tasks -> buildconfig -> generateBuildConfig`
4. Restart the IDE
The `common` module uses [fabric-loom]. This allows to use [ParchmentMC][parchment].<br>
Do not use Fabric related features inside the `common` module!
## **💚 Credits**
This project is using the [MultiLoader Template] by [Jared].<br>
The logo was made by [mo_shark].
## **🎓 License**
This project is licensed under the [GNU Lesser General Public License v3.0][license].
<!-- Badges -->
[version_badge]: https://img.shields.io/github/v/release/AlmostReliable/almostunified?include_prereleases&style=flat-square
[version_link]: https://github.com/AlmostReliable/almostunified/releases/latest
[total_downloads_cf_badge]: http://cf.way2muchnoise.eu/full_633823.svg?badge_style=flat
[total_downloads_mr_badge]: https://img.shields.io/modrinth/dt/sdaSaQEz?color=5da545&label=Modrinth&style=flat-square
[workflow_status_badge]: https://img.shields.io/github/actions/workflow/status/AlmostReliable/almostunified/build.yml?branch=1.19.2&style=flat-square
[workflow_status_link]: https://github.com/AlmostReliable/almostunified/actions
[license_badge]: https://img.shields.io/github/license/AlmostReliable/almostunified?style=flat-square
[maven_common_badge]: https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Falmostreliable%2Fmods%2Falmostunified-common%2Fmaven-metadata.xml&style=flat-square
[maven_common_link]: https://maven.blamejared.com/com/almostreliable/mods/almostunified-common/
[maven_fabric_badge]: https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Falmostreliable%2Fmods%2Falmostunified-fabric%2Fmaven-metadata.xml&style=flat-square
[maven_fabric_link]: https://maven.blamejared.com/com/almostreliable/mods/almostunified-fabric/
[maven_forge_badge]: https://img.shields.io/maven-metadata/v?color=C71A36&label=Latest%20version&logo=Latest%20version&metadataUrl=https%3A%2F%2Fmaven.blamejared.com%2Fcom%2Falmostreliable%2Fmods%2Falmostunified-forge%2Fmaven-metadata.xml&style=flat-square
[maven_forge_link]: https://maven.blamejared.com/com/almostreliable/mods/almostunified-forge/
<!-- Links -->
[minecraft]: https://www.minecraft.net/
[discord]: https://discord.com/invite/ThFnwZCyYY
[wiki]: https://github.com/AlmostReliable/almostunified/wiki
[curseforge]: https://www.curseforge.com/minecraft/mc-mods/almost-unified
[modrinth]: https://modrinth.com/mod/almost-unified
[releases]: https://github.com/AlmostReliable/almostunified/releases
[forge]: http://files.minecraftforge.net/
[fabric]: https://fabricmc.net/
[blamejared]: https://maven.blamejared.com
[api-wiki]: https://github.com/AlmostReliable/almostunified/wiki/API
[fabric-loom]: https://github.com/FabricMC/fabric-loom
[parchment]: https://parchmentmc.org/
[multiLoader template]: https://github.com/jaredlll08/MultiLoader-Template
[jared]: https://github.com/jaredlll08
[mo_shark]: https://www.curseforge.com/members/mo_shark
[license]: LICENSE

View file

@ -19,7 +19,6 @@ val githubRepo: String by project
val githubUser: String by project
val sharedRunDir: String by project
val reiVersion: String by project
val kubejsVersion: String by project
plugins {
java
@ -45,8 +44,6 @@ allprojects {
mavenLocal()
mavenCentral()
maven("https://maven.shedaniel.me")
maven("https://dvs1.progwml6.com/files/maven/")
maven("https://maven.saps.dev/minecraft")
maven("https://maven.blamejared.com/")
flatDir {
name = extraModsPrefix
@ -160,7 +157,6 @@ subprojects {
"forgeVersion" to forgeVersion,
"forgeFMLVersion" to forgeVersion.substringBefore("."), // Only use major version as FML error message sucks. The error message for wrong Forge version is way better.
"reiVersion" to reiVersion,
"kubejsVersion" to kubejsVersion,
"githubUser" to githubUser,
"githubRepo" to githubRepo
)

View file

@ -8,7 +8,7 @@ extraModsDirectory = extra-mods
junitVersion = 5.9.0
# Minecraft
minecraftVersion = 1.19.2
minecraftVersion = 1.19.3
# Mod
modVersion = 0.3.4
@ -19,17 +19,16 @@ modAuthor = Almost Reliable
modDescription = Unify all resources.
# Mod Dependencies
reiVersion = 9.1.580
jeiVersion = 11.4.0.290
kubejsVersion = 1902.6.0-build.132
reiVersion = 10.0.586
jeiVersion = 12.1.1.10
# Fabric Settings
fabricLoaderVersion = 0.14.9
fabricApiVersion = 0.68.0
fabricLoaderVersion = 0.14.13
fabricApiVersion = 0.73.2
fabricRecipeViewer = rei
# Forge Settings
forgeVersion = 43.2.0
forgeVersion = 44.1.5
forgeRecipeViewer = jei
# Github