ClassCastException: Twilight Forest SpikeBlock cannot be cast to LivingEntity in EtheriumEventHandler
illpasswolf2 opened this issue · 0 comments
Environment
Minecraft Version: 1.20.1
Forge Version: 47.3.22
Enigmatic Legacy Version: 2.30.1
Twilight Forest Version: 4.3.2508
Other Critical Mods: Observable (4.4.2), Citadel, Ice and Fire
Java Version: 17.0.9
Describe the Bug
When a Twilight Forest SpikeBlock entity attempts to damage a player, the server crashes with a ClassCastException. The error occurs because SpikeBlock (a non-living entity) is incorrectly cast to LivingEntity in EtheriumEventHandler.onEntityHurt.
Steps to Reproduce
Install Enigmatic Legacy, Twilight Forest, and their dependencies.
Enter the Twilight Forest dimension and trigger a SpikeBlock attack (e.g., by stepping on a trap).
Server crashes immediately with the following error:
### Crash Log Excerpt
Caused by: java.lang.ClassCastException:
twilightforest.entity.SpikeBlock cannot be cast to net.minecraft.world.entity.LivingEntity
at com.aizistral.etherium.core.EtheriumEventHandler.onEntityHurt(EtheriumEventHandler.java:46)
Full Crash Report: crash-2025-03-24_15.32.03-server.txt
Expected Behavior
The event handler should validate entity types before casting to LivingEntity, allowing non-living entities (like SpikeBlock) to be safely ignored.
Temporary Workarounds
Disabling enableEntityHurtEvent in enigmaticlegacy.cfg prevents the crash.
Adding a KubeJS script to cancel the event for twilightforest:spike_block.
Additional Context
The error occurs only when both Enigmatic Legacy and Twilight Forest are loaded.
The issue persists even after updating all mods to their latest versions.
No relevant errors are logged before the crash.
Request to Developers
Please add a type check for LivingEntity in EtheriumEventHandler.onEntityHurt to prevent invalid casts. Example fix:
java
if (event.getEntity() instanceof LivingEntity) {
// Existing logic
}
Attachments
Full Debug Log
Relevant Mod List
中文翻译说明
您好!我们在使用 Enigmatic Legacy 时遇到了因 Twilight Forest 的尖刺方块触发的类型转换崩溃。崩溃日志显示 EtheriumEventHandler 在未验证实体类型的情况下将 SpikeBlock 强制转换为 LivingEntity。恳请修复此问题,谢谢!