Skip to content

Commit

Permalink
rename added mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
BasiqueEvangelist committed Sep 7, 2024
1 parent 92cc60b commit 9e20c6c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/wispforest/owo/mixin/ext/ItemStackMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public class ItemStackMixin {

@Inject(method = "<init>(Lnet/minecraft/world/level/ItemLike;ILnet/minecraft/core/component/PatchedDataComponentMap;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/Item;verifyComponentsAfterLoad(Lnet/minecraft/world/item/ItemStack;)V"))
private void injectDerivedComponentMap(ItemLike item, int count, PatchedDataComponentMap components, CallbackInfo ci) {
var base = ((ComponentMapImplAccessor)(Object) this.components).owo$getBaseComponents();
var base = ((PatchedDataComponentMapAccessor)(Object) this.components).owo$getPrototype();

if (base instanceof DerivedComponentMap derived) {
owo$derivedMap = derived;
} else {
owo$derivedMap = new DerivedComponentMap(base);
((ComponentMapImplAccessor)(Object) this.components).owo$setBaseComponents(owo$derivedMap);
((PatchedDataComponentMapAccessor)(Object) this.components).owo$setPrototype(owo$derivedMap);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(PatchedDataComponentMap.class)
public interface ComponentMapImplAccessor {
public interface PatchedDataComponentMapAccessor {
@Accessor("prototype")
DataComponentMap owo$getBaseComponents();
DataComponentMap owo$getPrototype();

@Accessor("prototype")
@Mutable
void owo$setBaseComponents(DataComponentMap baseComponents);
void owo$setPrototype(DataComponentMap prototype);
}
2 changes: 1 addition & 1 deletion src/main/resources/owo.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"DataResultMixin",
"DataResultMixin$DataResultErrorMixin",
"DelegatingOpsAccessor",
"ext.ComponentMapImplAccessor",
"ext.PatchedDataComponentMapAccessor",
"ext.ComponentMapImplMixin",
"ext.ItemMixin",
"ext.ItemStackMixin",
Expand Down

0 comments on commit 9e20c6c

Please sign in to comment.