Jump to content

Recommended Posts

Posted

Sorry for my bad English, I`m from Poland.

 

Code:

package rpgcraft;
import java.awt.Event;
import java.util.ArrayList;
import java.util.Random;

import rpgcraft.blocks.Blockdarksapling;
import rpgcraft.blocks.blocks;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.BonemealEvent;

public class EventClass
{


@ForgeSubscribe
public void usedBonemeal(BonemealEvent event)
{
 int i = 0;
 int j =  (new Random()).nextInt(5);


 if (event.ID == blocks.darksapling.blockID)
 {
 if (i != j)
 i += i;
 else if (i == j)
 {
 if (!event.world.isRemote)
 {
	 ((Blockdarksapling)blocks.darksapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
	 event.setResult(Result.ALLOW);
 }
 }
 }
}
}

 

It work, tree is generating, but it don`t showing particles. Why? And how to fix it?

Posted

Sorry for my bad English, I`m from Poland.

 

Code:

package rpgcraft;
import java.awt.Event;
import java.util.ArrayList;
import java.util.Random;

import rpgcraft.blocks.Blockdarksapling;
import rpgcraft.blocks.blocks;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.player.BonemealEvent;

public class EventClass
{


@ForgeSubscribe
public void usedBonemeal(BonemealEvent event)
{
 int i = 0;
 int j =  (new Random()).nextInt(5);


 if (event.ID == blocks.darksapling.blockID)
 {
 if (i != j)
 i += i;
 else if (i == j)
 {
 if (!event.world.isRemote)
 {
	 ((Blockdarksapling)blocks.darksapling).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
	 event.setResult(Result.ALLOW);
 }
 }
 }
}
}

 

It work, tree is generating, but it don`t showing particles. Why? And how to fix it?

 

put this in the usedBonemeal event

par3World.spawnParticle("villagerHappy", par4, par5, par6, 0.0D, 0.5D, 0.0D);

Posted

When I`m add this, I have only errors and crash :(

 

PS:

World.spawnParticle("villagerHappy", par4, par5, par6, 0.0D, 0.5D, 0.0D);

give crash too.

Posted

When I`m add this, I have only errors and crash :(

 

PS:

World.spawnParticle("villagerHappy", par4, par5, par6, 0.0D, 0.5D, 0.0D);

give crash too.

ah... i didn't see that there was no World parameter try adding one like "World par3World"

Posted

Now, when I use:

public void usedBonemeal(World par3World, BonemealEvent event)

eclipse don`t show any errors, but minecraft has crashing.

 

When I use:

public void usedBonemeal(BonemealEvent event)

eclipse asking about change

public void spawnParticle(String par1Str, double par2, double par4, double par6, double par8, double par10, double par12)
    {
...
    }

to static. I can`t do it, becouse that make a lot of errors in other files (and i don`t edit vanilla code :P)

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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