Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

  • 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

  • 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

  • Author

a) What elix said.

b) Did you register to the FML EventBus? PlayerLoggedInEvent is an FML event.

a) No

b) Yep

 

VampZ modder

  • 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

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/

  • 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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.