Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PackRepositoryExtension not being present on PackRepository. #148

Open
wants to merge 3 commits into
base: 1.21.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.github.fabricators_of_create.porting_lib.mixin.common;

import com.google.common.collect.ImmutableSet;
import io.github.fabricators_of_create.porting_lib.extensions.PackRepositoryExtension;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.RepositorySource;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;

import java.util.HashSet;
import java.util.Set;

@Mixin(PackRepository.class)
public class PackRepositoryMixin implements PackRepositoryExtension {
@Mutable
@Shadow @Final private Set<RepositorySource> sources;

public void pl$addPackFinder(RepositorySource packFinder) {
if (sources instanceof ImmutableSet<RepositorySource>)
sources = new HashSet<>(sources);
sources.add(packFinder);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"common.MainMixin",
"common.MapDecorationMixin",
"common.MushroomCowMixin",
"common.PackRepositoryMixin",
"common.PiglinAiMixin",
"common.PistonMovingBlockEntityMixin",
"common.PistonStructureResolverMixin",
Expand Down
Loading