Posted May 9, 201510 yr I'm having a problem with my event It's spamming like crazy package com.neosup.VampZ.handler; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; public class Playerjoin { @SubscribeEvent public void Playerjoins(EntityJoinWorldEvent event){ if(event.world.isRemote){ event.world.setWorldTime(1600000); System.out.println("Time has changed"); } } } VampZ modder
May 9, 201510 yr Plus, do you want to do time changing on server instead? (world.isRemote() = client...) Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
May 9, 201510 yr Author Now it doesn'twork anymore package com.neosup.VampZ.handler; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; public class Playerjoin { @SubscribeEvent public void Playerjoins(PlayerLoggedInEvent event){ if(event.player.worldObj.isRemote && event.player.worldObj.isDaytime()){ event.player.worldObj.setWorldTime(160000); System.out.println("Time has changed"); } } } VampZ modder
May 9, 201510 yr Author Plus, do you want to do time changing on server instead? (world.isRemote() = client...) It seems logic to have it only for a singleplayer, because on a server it would be annoying(Every time somebody joins it becomes night) VampZ modder
May 9, 201510 yr Author a) What elix said. b) Did you register to the FML EventBus? PlayerLoggedInEvent is an FML event. a) No b) Yep VampZ modder
May 9, 201510 yr Author I fixed it with removing the IsRemote and i added getTotalWorldTime VampZ modder
May 9, 201510 yr Author It seems logic to have it only for a singleplayer Singleplayer is exactly the same as a multiplayer server. The server is just running on the same machine. Thanks for the info VampZ modder
May 9, 201510 yr Plus, do you want to do time changing on server instead? (world.isRemote() = client...) It seems logic to have it only for a singleplayer, because on a server it would be annoying(Every time somebody joins it becomes night) Checking whether you're in single player is different than checking if world is remote. Even in single player there is a server running. I think there is some other way to detect if you're in single player (and you still want to do the time change on the server in that case). Check out my tutorials here: http://jabelarminecraft.blogspot.com/
May 10, 201510 yr Author Plus, do you want to do time changing on server instead? (world.isRemote() = client...) It seems logic to have it only for a singleplayer, because on a server it would be annoying(Every time somebody joins it becomes night) Checking whether you're in single player is different than checking if world is remote. Even in single player there is a server running. I think there is some other way to detect if you're in single player (and you still want to do the time change on the server in that case). I wanted that if you spawn in the world it would be night, but not that everytime you join it would become night. I fixed it with using getTotalWorldTime. So the problem with single/multiplayer is fixed VampZ modder
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.