MixinVillagerEntity.java 763 Bytes
Newer Older
1 2 3 4 5 6 7 8
package com.owlmaddie.mixin;

import com.owlmaddie.utils.VillagerEntityAccessor;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.village.VillagerGossips;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

9 10 11 12
/**
 * The {@code MixinVillagerEntity} class adds an accessor to expose the gossip system of {@link VillagerEntity}.
 * This allows external classes to retrieve and interact with a villager's gossip data.
 */
13 14 15 16 17 18 19 20 21 22 23 24
@Mixin(VillagerEntity.class)
public abstract class MixinVillagerEntity implements VillagerEntityAccessor {

    @Shadow
    private VillagerGossips gossip;

    @Override
    // Access a Villager's gossip system
    public VillagerGossips getGossip() {
        return this.gossip;
    }
}