Skip to content

Commit

Permalink
Tweaks, ig still broken
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Jun 5, 2024
1 parent ffc8418 commit 2157fa0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ org.gradle.jvmargs=-Xmx4G
# Fabric Properties
# check these on https://fabricmc.net/use

minecraft_version=1.21-pre2
yarn_mappings=1.21-pre2+build.1
minecraft_version=1.21-pre3
yarn_mappings=1.21-pre3+build.1
loader_version=0.15.11

# Fabric API
fabric_version=0.99.2+1.21
fabric_version=0.99.5+1.21

maven_group = eu.pb4

mod_version = 0.9.0-alpha
mod_version = 0.9.0-pre.1

minecraft_version_supported = ">=1.20.5-"

packet_tweaker_version = 0.5.4-dev+1.20.6
packet_tweaker_version = 0.5.4+1.20.6

is_stable = false
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ public abstract class ItemGroupMixin implements ClientItemGroupExtension {
private Object polymerCore$bypassServerSide(Object entry) {
return entry instanceof InternalClientItemGroup ? ItemGroups.getDefaultTab() : entry;
}
// todo fix
/*@Inject(method = "updateEntries", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemGroup;reloadSearchProvider()V", shift = At.Shift.BEFORE), cancellable = true)
private void polymer$injectEntriesDynamic(ItemGroup.DisplayContext displayContext, CallbackInfo ci) {
if (((Object) this) instanceof InternalClientItemGroup) {
this.displayStacks.addAll(this.polymer$itemsGroup);
this.searchTabStacks.addAll(this.polymer$itemsSearch);
this.reloadSearchProvider();
ci.cancel();
}
}*/

@Inject(method = "updateEntries", at = @At("TAIL"))
private void polymer$injectEntriesVanilla(ItemGroup.DisplayContext arg, CallbackInfo ci) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Set;
import java.util.stream.Stream;

@Mixin(ItemGroups.class)
@Mixin(value = ItemGroups.class, priority = 1500)
public abstract class ItemGroupsMixin {
@Environment(EnvType.CLIENT)
@ModifyReturnValue(method = "stream", at = @At("RETURN"),require = 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
// todo
@Mixin(value = ItemGroup.class, priority = 3000)
@Mixin(value = ItemGroup.class, priority = 800)
public abstract class ItemGroupMixin implements ItemGroupExtra {
@Shadow private Collection<ItemStack> displayStacks;
@Shadow private Set<ItemStack> searchTabStacks;
Expand All @@ -50,7 +49,7 @@ public abstract class ItemGroupMixin implements ItemGroupExtra {
return PolymerItemGroupUtils.isPolymerItemGroup((ItemGroup) entry) ? ItemGroups.getDefaultTab() : entry;
}

@Inject(method = "updateEntries", at = @At(value = "FIELD", shift = At.Shift.AFTER, target = "Lnet/minecraft/item/ItemGroup$EntriesImpl;searchTabStacks:Ljava/util/Set;"), cancellable = true)
@Inject(method = "updateEntries", at = @At(value = "TAIL"), cancellable = true)
private void polymerCore$bypassFabricApiBS(ItemGroup.DisplayContext displayContext, CallbackInfo ci) {
if (PolymerItemGroupUtils.isPolymerItemGroup((ItemGroup) (Object) this) || this instanceof PolymerObject) {
ci.cancel();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.pb4.polymer.core.mixin.item;

import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import eu.pb4.polymer.core.api.item.PolymerItemGroupUtils;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand All @@ -11,20 +12,20 @@
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.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.util.Set;
import java.util.stream.Stream;

@Mixin(ItemGroups.class)
@Mixin(value = ItemGroups.class, priority = 1500)
public class ItemGroupsMixin {
@Environment(EnvType.SERVER)
@Inject(method = "stream", at = @At("RETURN"), cancellable = true, require = 0)
private static void polymerCore$injectServerItemGroups(CallbackInfoReturnable<Stream<ItemGroup>> cir) {
@ModifyReturnValue(method = "stream", at = @At("RETURN"))
private static Stream<ItemGroup> polymerCore$injectServerItemGroups(Stream<ItemGroup> original) {
if (PolymerItemGroupUtils.REGISTRY.size() > 0) {
cir.setReturnValue(Stream.concat(cir.getReturnValue(), PolymerItemGroupUtils.REGISTRY.stream()));
return Stream.concat(original, PolymerItemGroupUtils.REGISTRY.stream());
}
return original;
}

@Environment(EnvType.SERVER)
Expand Down

0 comments on commit 2157fa0

Please sign in to comment.