Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.mcreator.annoyingmod.procedures;
- import net.neoforged.neoforge.event.entity.player.PlayerEvent;
- import net.neoforged.fml.common.EventBusSubscriber;
- import net.neoforged.bus.api.SubscribeEvent;
- import net.neoforged.bus.api.Event;
- import net.minecraft.world.item.ItemStack;
- import net.minecraft.world.entity.player.Player;
- import net.minecraft.world.entity.Entity;
- import javax.annotation.Nullable;
- @EventBusSubscriber
- public class SetCraftingOutputProcedure {
- @SubscribeEvent
- public static void onItemCrafted(PlayerEvent.ItemCraftedEvent event) {
- execute(event, event.getEntity());
- }
- public static void execute(Entity entity) {
- execute(null, entity);
- }
- private static void execute(@Nullable Event event, Entity entity) {
- if (entity == null)
- return;
- if (entity instanceof Player _player && _player.containerMenu instanceof AnnoyingmodModMenus.MenuAccessor _menu) {
- _menu.getSlots().get(0).set(ItemStack.EMPTY);
- _player.containerMenu.broadcastChanges();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment