Search in sources :

Example 1 with InventoryMerchant

use of net.minecraft.inventory.InventoryMerchant in project Solar by Martacus.

the class EventHandler method onOpenVillagerGUI.

@SubscribeEvent
public static void onOpenVillagerGUI(PlayerContainerEvent event) {
    if (event.getContainer() instanceof ContainerMerchant) {
        ContainerMerchant merchantContainer = (ContainerMerchant) event.getContainer();
        InventoryMerchant merchant = merchantContainer.getMerchantInventory();
        EntityVillager villager = (EntityVillager) merchant.merchant;
        if (villager.getProfessionForge().getRegistryName().toString().equalsIgnoreCase(ModVillage.OLD_PRIEST_PROFESSION.getRegistryName().toString())) {
            event.setCanceled(true);
        }
    }
}
Also used : EntityVillager(net.minecraft.entity.passive.EntityVillager) ContainerMerchant(net.minecraft.inventory.ContainerMerchant) InventoryMerchant(net.minecraft.inventory.InventoryMerchant) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

EntityVillager (net.minecraft.entity.passive.EntityVillager)1 ContainerMerchant (net.minecraft.inventory.ContainerMerchant)1 InventoryMerchant (net.minecraft.inventory.InventoryMerchant)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1