1

Modding Help

Gear-Beast 9/14/13 12:45 am
434
9/15/2013 2:11 am
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 \/
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 //
}

}
Posted by
Gear-Beast
Level 6 : Apprentice Artist
0

  Have something to say?

JoinSign in

8

Heltrato
09/15/2013 2:11 am
Level 59 : Grandmaster System
Just study how cactus damage works
just copy that code and paste it in your block

1
RustyTurkeyBrain
09/14/2013 5:52 am
Level 32 : Artisan Electrician
Sounds like a cool idea, shame I can't help you with it though :/
1
Heltrato
09/14/2013 5:42 am
Level 59 : Grandmaster System
Want a lighter trick to learn ? aside from the upper comment of me =))

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
1
Gear-Beast
09/14/2013 5:45 pm
Level 6 : Apprentice Artist
Would you mind putting the code into my blocks source code? i cant seem to figure it out on how to make it work
1
Gear-Beast
09/14/2013 4:31 am
Level 6 : Apprentice Artist

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.
1
vivaminecraft
09/14/2013 1:39 am
Level 37 : Artisan Pixel Painter
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!
1
bmanrules
09/14/2013 5:15 am
Level 57 : Grandmaster Programmer
This ^

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);
1
twoonetwo212
09/14/2013 1:16 am
Level 11 : Journeyman Modder
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
1

Welcome