[root] update for 1.19.4-pre1
ci/woodpecker/push/docs Pipeline was successful Details
ci/woodpecker/push/jfmod Pipeline was successful Details

This commit is contained in:
Johannes Frohnmeyer 2023-02-26 12:49:00 +01:00
parent 5aac567273
commit 1d71c3870d
Signed by: Johannes
GPG Key ID: E76429612C2929F4
9 changed files with 14 additions and 49 deletions

View File

@ -5,7 +5,7 @@ libjf-data-manipulation-v0 provides code for modifying existing resources
RecipeUtil provides to methods to end users:
- `removeRecipe` blocks minecraft from loading recipes using the specified tag
- `removeRecipeFor` blocks minecraft from loading recipes producing the specified output. (Look at the log to find out which ones it blocks)
- ~~`removeRecipeFor` blocks minecraft from loading recipes producing the specified output. (Look at the log to find out which ones it blocks)~~ **removed for 1.19.4**
### UserResourceEvents
UserResourceEvents provides four events (CONTAINS, FIND_RESOURCE, OPEN, OPEN_ROOT) which get called every time

View File

@ -1,7 +1,7 @@
# https://fabricmc.net/develop/
minecraft_version=1.19.3
yarn_mappings=build.5
loader_version=0.14.15
minecraft_version=1.19.4-pre1
yarn_mappings=build.6
loader_version=0.14.17
maven_group=io.gitlab.jfronny.libjf
archive_base_name=libjf
@ -14,10 +14,10 @@ modrinth_optional_dependencies=fabric-api
curseforge_id=482600
curseforge_optional_dependencies=fabric-api
fabric_version=0.75.0+1.19.3
commons_version=1.0-SNAPSHOT
fabric_version=0.75.1+1.19.4
commons_version=1.1-SNAPSHOT
gson_compile_version=1.2-SNAPSHOT
modmenu_version=5.0.2
modmenu_version=6.1.0-beta.3
asm_version=9.4
ant_version=1.10.12

View File

@ -18,7 +18,7 @@ public class PlaceholderScreen extends Screen {
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
renderBackground(matrices);
drawCenteredText(matrices, textRenderer, description, width / 2, (height - textRenderer.fontHeight) / 2, 0xFFFFFF);
drawCenteredTextWithShadow(matrices, textRenderer, description, width / 2, (height - textRenderer.fontHeight) / 2, 0xFFFFFF);
super.render(matrices, mouseX, mouseY, delta);
}

View File

@ -118,7 +118,7 @@ public class TinyConfigScreen extends Screen {
this.renderBackground(matrices);
this.list.render(matrices, mouseX, mouseY, delta);
drawCenteredText(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
Optional<Text> hovered = list.getHoveredEntryTitle(mouseY);
if (hovered.isPresent()) {

View File

@ -53,7 +53,7 @@ public class PresetsScreen extends Screen {
this.renderBackground(matrices);
this.list.render(matrices, mouseX, mouseY, delta);
drawCenteredText(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
drawCenteredTextWithShadow(matrices, textRenderer, title, width / 2, 15, 0xFFFFFF);
super.render(matrices, mouseX, mouseY, delta);
}

View File

@ -1,7 +1,5 @@
package io.gitlab.jfronny.libjf.data.manipulation.api;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import java.util.HashSet;
@ -10,26 +8,12 @@ import java.util.Set;
@SuppressWarnings("unused")
public class RecipeUtil {
private static final Set<Identifier> REMOVAL_BY_ID = new HashSet<>();
private static final Set<ItemStack> RECIPES_FOR_REMOVAL = new HashSet<>();
public static void removeRecipe(Identifier identifier) {
REMOVAL_BY_ID.add(identifier);
}
public static void removeRecipeFor(Item product) {
RECIPES_FOR_REMOVAL.add(product.getDefaultStack());
}
public static boolean isIdBlocked(Identifier identifier) {
return REMOVAL_BY_ID.contains(identifier);
}
public static boolean isOutputBlocked(ItemStack product) {
for (ItemStack stack : RECIPES_FOR_REMOVAL) {
if (product.isItemEqual(stack)) {
return true;
}
}
return false;
}
}

View File

@ -1,20 +1,15 @@
package io.gitlab.jfronny.libjf.data.manipulation.mixin;
package io.gitlab.jfronny.libjf.data.manipulation.impl.mixin;
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonObject;
import io.gitlab.jfronny.libjf.LibJf;
import io.gitlab.jfronny.libjf.data.manipulation.api.RecipeUtil;
import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeManager;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.*;
@Mixin(RecipeManager.class)
public class RecipeManagerMixin {
@ -34,17 +29,4 @@ public class RecipeManagerMixin {
return replacement.iterator();
}
@Redirect(method = "apply(Ljava/util/Map;Lnet/minecraft/resource/ResourceManager;Lnet/minecraft/util/profiler/Profiler;)V", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/ImmutableMap$Builder;put(Ljava/lang/Object;Ljava/lang/Object;)Lcom/google/common/collect/ImmutableMap$Builder;", remap = false))
private ImmutableMap.Builder<Identifier, Recipe<?>> onPutRecipe(ImmutableMap.Builder<Identifier, Recipe<?>> builder, Object key, Object value) {
Identifier id = (Identifier) key;
Recipe<?> recipe = (Recipe<?>) value;
if (RecipeUtil.isOutputBlocked(recipe.getOutput())) {
LibJf.LOGGER.info("Blocked recipe by predicate: " + recipe.getId());
return builder;
}
return builder.put(id, recipe);
}
}

View File

@ -1,7 +1,7 @@
{
"required": true,
"minVersion": "0.8",
"package": "io.gitlab.jfronny.libjf.data.manipulation.mixin",
"package": "io.gitlab.jfronny.libjf.data.manipulation.impl.mixin",
"compatibilityLevel": "JAVA_16",
"mixins": [
"RecipeManagerMixin"

View File

@ -18,6 +18,5 @@ public class TestEntrypoint implements ModInitializer {
}
return previous;
});
RecipeUtil.removeRecipeFor(Items.DIAMOND_SWORD);
}
}
}