From 8734c2e9d6661ae683f9ef70892097e469958d1b Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Fri, 21 Mar 2025 19:45:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E6=AD=A2TACZ=E6=9E=AA=E5=AF=B9?= =?UTF-8?q?=E4=BA=8E=E8=BD=BD=E5=85=B7=E8=BF=9B=E8=A1=8C=E7=88=86=E5=A4=B4?= =?UTF-8?q?=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/atsuishio/superbwarfare/ModUtils.java | 6 ++++++ .../superbwarfare/event/TACZGunEventHandler.java | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/main/java/com/atsuishio/superbwarfare/event/TACZGunEventHandler.java 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); + } + } +}