Skip to content
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,15 @@
package io.wispforest.accessories.mixin;

import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
import net.minecraft.core.component.DataComponentPatch;
import net.minecraft.core.component.DataComponentType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Optional;

@Mixin(DataComponentPatch.class)
public interface DataComponentPatchAccessor {
@Accessor
Reference2ObjectMap<DataComponentType<?>, Optional<?>> getMap();
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ public abstract class PatchedDataComponentMapMixin implements PatchedDataCompone
private void accessories$updateChangeValue_applyPatchTail(DataComponentPatch patch, CallbackInfo ci){
this.inApplyPatchLock = false;

var list = new ArrayList<DataComponentType<?>>();
for (var entry : patch.entrySet()) list.add(entry.getKey());
this.accessories$handleMutationEvent(list);
if (this.mutationEvent == null) {
return;
}

var changedDataTypes = new ArrayList<>(((DataComponentPatchAccessor) (Object) patch).getMap().keySet());

this.accessories$handleMutationEvent(changedDataTypes);
}

@Inject(method = "applyPatch(Lnet/minecraft/core/component/DataComponentType;Ljava/util/Optional;)V", at = @At("HEAD"))
Expand All @@ -103,9 +107,13 @@ public abstract class PatchedDataComponentMapMixin implements PatchedDataCompone
private void accessories$updateChangeValue_restorePatch(DataComponentPatch patch, CallbackInfo ci){
this.changeCheckStack = true;

var list = new ArrayList<DataComponentType<?>>();
for (var entry : patch.entrySet()) list.add(entry.getKey());
this.accessories$handleMutationEvent(list);
if (this.mutationEvent == null) {
return;
}

var changedDataTypes = new ArrayList<>(((DataComponentPatchAccessor) (Object) patch).getMap().keySet());

this.accessories$handleMutationEvent(changedDataTypes);
}

@Unique
Expand Down
15 changes: 8 additions & 7 deletions common/src/main/resources/accessories-common.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,32 @@
"client.cosmetic.LivingEntityMixin",
"client.cosmetic.MobMixin",
"client.cosmetic.PlayerMixin",
"client.model.BlockEntityRenderersMixin",
"client.model.EntityModelSetMixin",
"client.model.EntityRenderersMixin",
"client.model.ModelMixin",
"client.owo.BaseComponentMixin",
"client.owo.BaseParentComponentMixin",
"client.owo.ComponentMixin",
"client.owo.ComponentStubMixin",
"client.owo.DiscreteSliderComponentAccessor",
"client.owo.ScissorStackMixin",
"client.owo.ScrollContainerMixin",
"sodium.MPOATVConstructingVertexConsumerMixin_SodiumImpl",
"client.model.EntityModelSetMixin",
"client.model.ModelMixin",
"client.model.EntityRenderersMixin",
"client.model.BlockEntityRenderersMixin"
"sodium.MPOATVConstructingVertexConsumerMixin_SodiumImpl"
],
"mixins": [
"ApplyBonusCountMixin",
"ArmorSlotMixin",
"ConfigurableRegistryLookupAccessor",
"CraftingMenuAccessor",
"CriteriaTriggersAccessor",
"DataComponentPatchAccessor",
"DelegatingOpsAccessor",
"EnchantedCountIncreaseFunctionMixin",
"EnchantmentAttributeEffectMixin",
"EnchantmentHelperMixin",
"EndermanMixin",
"EntityTrackerAccessor",
"EquipmentSlotMixin",
"EquipmentSlotTypeMixin",
"HolderLookupAdapterAccessor",
Expand All @@ -61,12 +63,11 @@
"PlayerMixin",
"PowderSnowBlockMixin",
"RegistryOpsAccessor",
"ServerChunkLoadingManagerAccessor",
"SlotAccessor",
"StateHolderAccessor",
"StriderMixin",
"owo.ConfigWrapperAccessor",
"ServerChunkLoadingManagerAccessor",
"EntityTrackerAccessor",
"temp_fixes.NbtCompoundMixin",
"temp_fixes.NbtUtilsMixin"
],
Expand Down