diff --git a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java index d051f2ef9..7ce3c5269 100644 --- a/src/main/java/com/atsuishio/superbwarfare/ModUtils.java +++ b/src/main/java/com/atsuishio/superbwarfare/ModUtils.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.client.MouseMovementHandler; import com.atsuishio.superbwarfare.config.ClientConfig; import com.atsuishio.superbwarfare.config.CommonConfig; import com.atsuishio.superbwarfare.config.ServerConfig; +import com.atsuishio.superbwarfare.event.TACZGunEventHandler; import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.ModVariables; import com.atsuishio.superbwarfare.network.message.*; @@ -19,6 +20,7 @@ import net.minecraftforge.common.brewing.BrewingRecipeRegistry; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModList; import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.config.ModConfig; @@ -71,6 +73,10 @@ public class ModUtils { bus.addListener(this::onCommonSetup); bus.addListener(this::onClientSetup); + if (ModList.get().isLoaded("tacz")) { + MinecraftForge.EVENT_BUS.addListener(TACZGunEventHandler::entityHurtByTACZGun); + } + MinecraftForge.EVENT_BUS.register(this); } diff --git a/src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java new file mode 100644 index 000000000..0a385696e --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java @@ -0,0 +1,12 @@ +package com.atsuishio.superbwarfare.event; + +import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; +import com.tacz.guns.api.event.common.EntityHurtByGunEvent; + +public class TACZGunEventHandler { + public static void entityHurtByTACZGun(EntityHurtByGunEvent.Pre event) { + if (event.getHurtEntity() instanceof VehicleEntity) { + event.setHeadshot(false); + } + } +}