Hello, I am trying to make event, that triggers when I attack any mob and it will summon primed tnt and it will instantly blow up.
What was always working was that I placed block under that entity.
My code for placing blocks under entity:
@Mod.EventBusSubscriber(modid = Geornamezi.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
public class ModClientEvents {
@SubscribeEvent
public static void attackEntity(AttackEntityEvent event) {
if (event.getEntityLiving().getHeldItemMainhand().getItem() == RegistryHandler.GEORNAMEZI.get()) {
if (event.getTarget().isAlive()) {
LivingEntity target = (LivingEntity) event.getTarget();
if (target instanceof Entity) {
World world = target.getEntityWorld();
world.setBlockState(target.getPosition().add(0, -1, 0), RegistryHandler.GEORNAMEZI_BLOCK.get().getDefaultState());
}
}
}}
I seen that there is world.createExplosion(), but i dont know, how to get things working inside that brackets.
Important thing is that, I am using using Forge 1.16.1 32.0.63 with mappings from July 7, 2020 (because i dont know, how to code with newer and mapped mappings).
Thank you for any post on this theme.
George