Posted February 8, 20232 yr Hello, I want the player's hitbox to get smaller (e.g. when pressing a key combination). To do this, I assigned a tag to the player, but the Entityevent.Size event does not fire. Can someone help me? package de.chrisicrafter.vampires.event; import de.chrisicrafter.vampires.Vampires; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.player.Player; import net.minecraftforge.event.entity.EntityEvent; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = Vampires.MODID) public class ModEvents { @SubscribeEvent public void onSizeEvent(EntityEvent.Size event) { Vampires.LOGGER.info("Size Event"); Player player = (Player) event.getEntity(); if (player.getTags().contains("small")) { Vampires.LOGGER.info("SMALL"); event.setNewSize(new EntityDimensions(0.5f,0.25f,true)); } else { Vampires.LOGGER.info("NORMAL"); event.setNewSize(new EntityDimensions(1f,1f,true)); } } @SubscribeEvent public void onLoginEvent(PlayerEvent.PlayerLoggedInEvent event) { System.out.println("Login Event"); Player player = (Player) event.getEntity(); } @SubscribeEvent public static void onLivingAttackEvent(LivingAttackEvent event) { Vampires.LOGGER.info("event is here"); } } NOTE: - The LivingAttackEvent works
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.