-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/io/github/rektroth/whiteout/mixin/entity/decoration/ItemFrameEntityMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Patch for MC-252817 | ||
* | ||
* Authored for CraftBukkit/Spigot by braindead <[email protected]> on November 5, 2022. | ||
* Ported to Fabric by Rektroth <[email protected]> on April 25, 2024. | ||
*/ | ||
|
||
package io.github.rektroth.whiteout.mixin.entity.decoration; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import com.llamalad7.mixinextras.sugar.ref.LocalRef; | ||
import net.minecraft.component.DataComponentTypes; | ||
import net.minecraft.component.type.MapIdComponent; | ||
import net.minecraft.entity.decoration.ItemFrameEntity; | ||
import net.minecraft.item.ItemStack; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(ItemFrameEntity.class) | ||
public abstract class ItemFrameEntityMixin { | ||
@Inject( | ||
at = @At( | ||
target = "Lnet/minecraft/entity/decoration/ItemFrameEntity;getMapId()Lnet/minecraft/component/type/MapIdComponent;", | ||
value = "INVOKE_ASSIGN"), | ||
method = "removeFromFrame(Lnet/minecraft/item/ItemStack;)V" | ||
) | ||
private void getMapIdFromItem(ItemStack stack, CallbackInfo ci, @Local LocalRef<MapIdComponent> mapIdComponent) { | ||
mapIdComponent.set(stack.get(DataComponentTypes.MAP_ID)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters