Skip to content

Commit

Permalink
fix: fix accesswideners and move them to be per-module
Browse files Browse the repository at this point in the history
  • Loading branch information
CallMeEchoCodes committed Sep 5, 2024
1 parent d49f5a7 commit 0dd6f89
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 13 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ allprojects {

loom {
splitEnvironmentSourceSets()
accessWidenerPath = rootDir.absoluteFile.resolve("src/main/resources/specter.accesswidener")
if (file("src/main/resources/${project.name}.accesswidener").exists()) accessWidenerPath =
file("src/main/resources/${project.name}.accesswidener")
}

for (modProject in allprojects) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true
#fabric.loom.multiProjectOptimisation=true
mod.version=1.0.0-SNAPSHOT4
mod.version=1.0.0-SNAPSHOT5
mod.group=dev.spiritstudios.specter
mod.id=specter
deps.minecraft=1.21
Expand Down
1 change: 1 addition & 0 deletions specter-debug/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"mixins": [
"specter-debug.mixins.json"
],
"accessWidener": "specter-debug.accesswidener",
"custom": {
"modmenu": {
"parent": "specter",
Expand Down
2 changes: 2 additions & 0 deletions specter-debug/src/main/resources/specter-debug.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accessWidener v2 named
accessible field net/minecraft/registry/Registries ROOT Lnet/minecraft/registry/MutableRegistry;
1 change: 1 addition & 0 deletions specter-entity/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"environment": "client"
}
],
"accessWidener": "specter-entity.accesswidener",
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": "~${minecraft_version}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accessWidener v2 named
accessible field net/minecraft/entity/attribute/DefaultAttributeContainer instances Ljava/util/Map;
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static SpecterShapedRecipeJsonBuilder create(RecipeCategory category, Ite
public void offerTo(RecipeExporter exporter, Identifier recipeId) {
ShapedRecipeJsonBuilderAccessor accessor = (ShapedRecipeJsonBuilderAccessor) this;

RawShapedRecipe rawShapedRecipe = this.validate(recipeId);
RawShapedRecipe rawShapedRecipe = accessor.callValidate(recipeId);
Advancement.Builder builder = exporter.getAdvancementBuilder()
.criterion("has_the_recipe", RecipeUnlockedCriterion.create(recipeId))
.rewards(AdvancementRewards.Builder.recipe(recipeId))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.spiritstudios.specter.impl.item;

import net.minecraft.advancement.AdvancementCriterion;
import net.minecraft.recipe.RawShapedRecipe;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.util.Identifier;

import java.util.Map;

Expand All @@ -15,4 +17,6 @@ public interface ShapedRecipeJsonBuilderAccessor {
int getCount();

boolean getShowNotification();

RawShapedRecipe callValidate(Identifier recipeId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import dev.spiritstudios.specter.impl.item.SpecterItem;
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
import net.minecraft.block.ComposterBlock;
import net.minecraft.item.ItemConvertible;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

@Mixin(ComposterBlock.ComposterInventory.class)
@Mixin(targets = "net.minecraft.block.ComposterBlock$ComposterInventory")
public class ComposterBlock$ComposterInventoryMixin {
@WrapOperation(method = "canInsert", at = @At(value = "INVOKE", target = "Lit/unimi/dsi/fastutil/objects/Object2FloatMap;containsKey(Ljava/lang/Object;)Z", remap = false))
private boolean canInsert(Object2FloatMap<ItemConvertible> instance, Object o, Operation<Boolean> original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import dev.spiritstudios.specter.impl.item.ShapedRecipeJsonBuilderAccessor;
import net.minecraft.advancement.AdvancementCriterion;
import net.minecraft.data.server.recipe.ShapedRecipeJsonBuilder;
import net.minecraft.recipe.RawShapedRecipe;
import net.minecraft.recipe.book.RecipeCategory;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

import java.util.Map;

Expand All @@ -30,4 +33,8 @@ public abstract class ShapedRecipeJsonBuilderMixin implements ShapedRecipeJsonBu
@Override
@Accessor
public abstract boolean getShowNotification();

@Override
@Invoker
public abstract RawShapedRecipe callValidate(Identifier recipeId);
}
2 changes: 2 additions & 0 deletions specter-item/src/main/resources/specter-item.accesswidener
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accessWidener v2 named
accessible method net/minecraft/item/ItemGroup <init> (Lnet/minecraft/item/ItemGroup$Row;ILnet/minecraft/item/ItemGroup$Type;Lnet/minecraft/text/Text;Ljava/util/function/Supplier;Lnet/minecraft/item/ItemGroup$EntryCollector;)V
1 change: 1 addition & 0 deletions specter-registry/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"mixins": [
"specter-registry.mixins.json"
],
"accessWidener": "specter-registry.accesswidener",
"depends": {
"fabricloader": ">=${loader_version}",
"minecraft": "~${minecraft_version}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
accessWidener v2 named
accessible field net/minecraft/registry/Registries ROOT Lnet/minecraft/registry/MutableRegistry;
1 change: 0 additions & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"fabric-api": "*",
"java": ">=21"
},
"accessWidener": "specter.accesswidener",
"custom": {
"modmenu": {
"badges": [
Expand Down
7 changes: 0 additions & 7 deletions src/main/resources/specter.accesswidener

This file was deleted.

0 comments on commit 0dd6f89

Please sign in to comment.