Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED]How to stop event from spamming


NeoSup2130
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I don't much about this, but I do know you can't use the fog for this. The fog is designed to limit the player's view distance, e.g. if they are in lava or water, but mainly so the game doesn't have to draw all the way to "infinity". This means all the fog rendering code is based on the distance to camera. It's an illusion, it's not based on something physically in the world at some position.   Spit balling: I would guess you want something more like how clouds are drawn? But again these are partially an illusion. They are procedurally generated rather than being physically in the world, but they are kind of drawn at a location. You can use forge's RenderLevelLastEvent to draw over the world. Look at LevelRenderer.renderClouds() for how clouds are drawn.  
    • Problem with Electrodynamics. Talk to the mod author.
    • here is my github if you want to check what I did https://github.com/Socrateee/Mist
    • Hi, i'm trying to create a sort of  toxic "mist" in minecraft wich will be cleared by a machine. To create my mist I modified minecraft RenderSystem using the setShaderFogStart and End and setShaderFogColor methods and the EntityViewRenderEvent from forge to update it. The final idea is to make the block create  a protective sphere where there is no toxic mist. What I've done from now is to apply the toxic fog effect to the player when he leaves a sphere i defined (center : 10 100 10 in the World, radius = 10 blocks ). Here is how it looks : https://imgur.com/WdAhF3D (inside the sphere) https://imgur.com/PcluWul (outside the sphere)   The reason why i'm posting here is because I have a problem that I can't solve : as you can see in the picture 1, when inside the fog clear zone the player can see clearly through the sphere's border wich makes no sens as the outsides of the sphere is supposed to be toxic. What I would like to do is to make the outside of the sphere look the same as when we are outside of it (I hope what I say makes sense, English is not my native language ), how can I achieve that ? Maybe modifing the fog center effect to be centered on the sphere center (10 100 10 ) instead of the player itself ? Is it possible ? Do you think about an another way accomplishing what i descibed ?  I really hope what I said made sense and that I made a correct description of what i want to accomplish Have a nice day !    
  • Topics

×
×
  • Create New...

Important Information

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