Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

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

Posted

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/

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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