mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-28 23:59:00 +00:00
[1.18.x] Fixed PlayerInteractEvent.EntityInteractSpecific being called too late (#9494)
This commit is contained in:
1 parent
435de780a8
commit
d6cd51191e
3 files changed
+44
-5
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.debug.entity.player;
|
||||
|
||||
import net.minecraft.world.entity.decoration.ArmorStand;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod("entity_interact_specific_event_test")
|
||||
@Mod.EventBusSubscriber
|
||||
public class EntityInteractSpecificEventTest
|
||||
{
|
||||
private static final boolean ENABLE = false;
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onEntityInteractSpecific(PlayerInteractEvent.EntityInteractSpecific event)
|
||||
{
|
||||
if (!ENABLE) return;
|
||||
if (event.getTarget() instanceof ArmorStand)
|
||||
{
|
||||
LOGGER.info("EntityInteractSpecific event has been canceled for armor stand");
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,5 +242,7 @@ license="LGPL v2.1"
|
||||
modId="block_grow_feature_test"
|
||||
[[mods]]
|
||||
modId="grindstone_event_test"
|
||||
[[mods]]
|
||||
modId="entity_interact_specific_event_test"
|
||||
|
||||
# ADD ABOVE THIS LINE
|
||||
Reference in new issue
Block a user