1
Modding Help
im fairly new to modding, i've been doing it for a month, anyways the point is i need some help with a block i have made, i want the block to set you on fire when ever you walk on top of it. im wondering if theirs anyway of doing this.
my blocks source code \/
my blocks source code \/
package OverHaul.OverHaul;
import java.util.Random;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class MoltenRockBlock extends Block {
public MoltenRockBlock(int i) {
super(i, Material.rock);
setCreativeTab(OverHaulMainClass.OverHaulTab); // Creative Tab //
}
// Drops when broken //
public int idDropped(int par1, Random par2Random, int par3)
{
return OverHaulMainClass.MoltenRock.blockID;
}
public int quantityDropped(Random random)
{
return 1; //Return Amount //
}
public void registerIcons(IconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("OverHaulMainClass:MoltenRock"); // texture name //
}
}
8
Just study how cactus damage works
just copy that code and paste it in your block
just copy that code and paste it in your block
Sounds like a cool idea, shame I can't help you with it though :/
Want a lighter trick to learn ? aside from the upper comment of me =))
Look at the Cactus code
It says somewhere its code
This code means whenever an Entity collides with him . And it deals the damage source =))
So if you wanna make it fire you need to change from damagesource.cactus into damagesource.inFire =)))
You can copy paste this code in your block but not the whole just the void.
this will help you bro =)
Remember all great modders started from reading the class of the vanilla minecraft and Learn JAVA
Look at the Cactus code
It says somewhere its code
/**
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
*/
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
par5Entity.attackEntityFrom(DamageSource.cactus, 1.0F);
}
This code means whenever an Entity collides with him . And it deals the damage source =))
So if you wanna make it fire you need to change from damagesource.cactus into damagesource.inFire =)))
You can copy paste this code in your block but not the whole just the void.
this will help you bro =)
Remember all great modders started from reading the class of the vanilla minecraft and Learn JAVA
Would you mind putting the code into my blocks source code? i cant seem to figure it out on how to make it work
Well, if there's a way to make blocks light up when you step on them, I'm sure you can make them burn, too.....but I don't know how. :3
Thanks for the idea, ive got the code to make it set the player on fire when they walk on it "this.isBlockBurning", but i dont know how to activate it . i tried looking at redstone ore's principles but no info their.
I'm not really a modder but I got a guess. Your block could have the same principle as redstone, when you walk on the block it updates. Don't blame me if it doesn't work!
This ^
I'm not going to give you the exact code, but here's the function:
and use:
I'm not going to give you the exact code, but here's the function:
public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)and use:
par5Entity.setFire(int);Gear-Beastim fairly new to modding, i've been doing it for a month, anyways the point is i need some help with a block i have made, i want the block to set you on fire when ever you walk on top of it. im wondering if theirs anyway of doing this.
my blocks source code \/package OverHaul.OverHaul;
import java.util.Random;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
public class MoltenRockBlock extends Block {
public MoltenRockBlock(int i) {
super(i, Material.rock);
setCreativeTab(OverHaulMainClass.OverHaulTab); // Creative Tab //
}
// Drops when broken //
public int idDropped(int par1, Random par2Random, int par3)
{
return OverHaulMainClass.MoltenRock.blockID;
}
public int quantityDropped(Random random)
{
return 1; //Return Amount //
}
public void registerIcons(IconRegister iconRegister) {
blockIcon = iconRegister.registerIcon("OverHaulMainClass:MoltenRock"); // texture name //
}
}
Well, if there's a way to make blocks light up when you step on them, I'm sure you can make them burn, too.....but I don't know how. :3
