Jump to content

vova7865

Members
  • Posts

    6
  • Joined

  • Last visited

vova7865's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. What do you have in projectDir/build/tmp/recompileMc ?
  2. Try gradlew setupDecompWorkspace --stacktrace , then post the log
  3. Thanks! Another question: do ElderGuardians fire this event when they spawn in the monuments?
  4. Write the list of your mods, some of them may not be compatible.
  5. I have this code: package com.vova7865.essencecraft; import java.util.UUID; import com.mojang.authlib.GameProfile; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.server.MinecraftServer; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class EventHandler { @SubscribeEvent public void livingSpawn(LivingSpawnEvent event) { if(event.getEntityLiving().toString().contains("Guardian")) { EntityLiving living = (EntityLiving) event.getEntityLiving(); World world = event.getWorld(); WorldServer serverWorld = DimensionManager.getWorld(0); GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "FakePlayer"); FakePlayer fakePlayer = new FakePlayer(serverWorld, gameProfile); MinecraftServer minecraftServer = fakePlayer.mcServer; String playerNames[] = minecraftServer.getOnlinePlayerNames(); String firstPlayerName = playerNames[0]; EntityPlayer player = world.getPlayerEntityByName(firstPlayerName); double x = player.posX; double y = player.posY; double z = player.posZ; living.attemptTeleport(x, y, z) } } } So when the guardians spawn, they teleport to me. They do, but the same guardians are teleported to me multiple times, so I think that LivingSpawnEvent is fired not only when they spawn. Anyone knows how can I do some code only when the mob spawns?
×
×
  • Create New...

Important Information

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