Jump to content

Any good wait methods?


timoteo2000

Recommended Posts

Then every tick cycle through all elements and tick() them. if one of them returns true, remove it. When you want to schedule something, just add a new QueueElement to the set.

P.S.: Please learn java.

Thanks for that, but again, how am I supposed to tell it all of the coordinates of the block?

Since I have exactly 80 times a block needs to be set to fire, it would be rather annoying to use a Set.add() method for all of them, but I'm assuming that is what I'll have to do. I can't do, say "Set.add(x + 0, y + 1, z + 0)" because it only wants one object, or "Set.add(x + 0); [next line] Set.add(y + 1); [next line] Set.add(z + 0);" because it won't see that as one object.

 

I do know it's probably somewhat irritating dealing with my still-learning intelligence level, and I am sorry for that.

EntityHerobrine.setDead();

 

Pwned.

Link to comment
Share on other sites

Don't store all the blocks. Only store the x,y,z of the block clicked. Then when 10 ticks have passed replicate the algorithm you use for placing the fire and place air instead.

And dont put the coordinates directly into the set. You need a wrapper class like I posted.

So what method in Set would I use? I thought .add(Object) was right, but you can't store 3 co-ords at one time (x, y, z) only a single one (x) (y) (z).

I have a wrapper class, and it's pretty much what you showed me with a different name.

package com.lesterhouse.timo;

import net.minecraft.world.World;

public class BlockQueue {

public final World w;
public final int x;
public final int y;
public final int z;
private int ticks;

public BlockQueue(World w, int x, int y, int z) {
	this.w = w;
	this.x = x;
	this.y = y;
	this.z = z;
}

public boolean tick() {
	ticks++;
	if (ticks == 10) {
                        //All 80 instances of w.setBlock that mimics the 80 in ItemFirePowder, but with air
		return true;
	} else {
		return false;
	}
}

}

So I guess all I'm asking is: Where would I implement my new set and how to record the three different set co-ords of the block right clicked, which if the user isn't stupid is right below them.

EntityHerobrine.setDead();

 

Pwned.

Link to comment
Share on other sites

That code is not set in stone, please try to understand it and adjust it for your needs ;)

Okay, so that all helped. But, the code stopped right at the tick() method. I know this, as I put a println() inside of tick() and one inside of if(ticks == 10) and the one in tick responded but not the one in the if statement.

So it doesn't increment the ticks, I guess? Also, I had to change one thing to the thing you wanted me to put in onItemUse. It didn't work, and it threw errors, so I turned it from:

YourMod.getTickHandler().addElement(new BlockQueue(world, x, y, z));

to

ClientTickHandler.addElement(new BlockQueue(world, x, y, z));

And it didn't throw errors, luckily, but still didn't clear the fire, as it never reached the if statement. So either the Set isn't enumerating the object I gave it or the ticks never increment.

EntityHerobrine.setDead();

 

Pwned.

Link to comment
Share on other sites

Why do you make the method addElement static?

Please post your complete TickHandler.

Here it is:

 

package com.lesterhouse.timo.client;

import java.util.EnumSet;
import java.util.Iterator;
import java.util.Set;

import com.google.common.collect.Sets;
import com.lesterhouse.timo.BlockQueue;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;

import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;

public class ClientTickHandler implements ITickHandler {


private Set<BlockQueue> queue = Sets.newHashSet();

public void addElement(BlockQueue element) {
    queue.add(element);
}

public void tickStart(EnumSet<TickType> types, Object... tickData) {
    Iterator<BlockQueue> it = queue.iterator();
    while (it.hasNext()) {
        if (it.next().tick()) {
            it.remove();
        }
    }
}

@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData)
{
	if (type.equals(EnumSet.of(TickType.RENDER)))
	{
		onRenderTick();
	}
	else if (type.equals(EnumSet.of(TickType.CLIENT)))
	{
		GuiScreen guiscreen = Minecraft.getMinecraft().currentScreen;
		if (guiscreen != null)
		{
			onTickInGUI(guiscreen);
		} else {
			onTickInGame();
		}
	}
}

@Override
public EnumSet<TickType> ticks()
{
	return EnumSet.of(TickType.RENDER, TickType.CLIENT);
	// In my testing only RENDER, CLIENT, & PLAYER did anything on the client side.
	// Read 'cpw.mods.fml.common.TickType.java' for a full list and description of available types
}

@Override
public String getLabel() { return null; }


public void onRenderTick()
{
	//System.out.println("onRenderTick");
	//TODO: Your Code Here
}

public void onTickInGUI(GuiScreen guiscreen)
{
	//System.out.println("onTickInGUI");
	//TODO: Your Code Here
}



public void onTickInGame()
{

}
}

 

 

I had to make the first method just public because the void there gave me errors, saying "volatile expected."

EntityHerobrine.setDead();

 

Pwned.

Link to comment
Share on other sites

Why are you doing this on the Client Side? World modification must only happen server side.

I guess I really didn't think of that >.<

Well, don't I still need to tell the client something?

Edit: Yay! it finally works! So, I changed the first thing that defined Set<BlockQueue> as queue into a public static rather than void and it all works fine. I right click a block with Fire Powder, and believe it or not, 1/2 a second later the fire that appeared went away! Thanks for all your help diesie, and I hope to release this mod before 1.5 comes out. Now to add the items that Fire Powder crafts into :D

EntityHerobrine.setDead();

 

Pwned.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

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