Jump to content

Thomas Schwarz

Members
  • Posts

    3
  • Joined

Everything posted by Thomas Schwarz

  1. Nevermind forgot to make the other methods static. It works
  2. Sorry I am new to java and modding. What do you mean?
  3. 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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.