BlockStair doesn't take a texture ID for its initializer. It should be new BlockStairs(99, blah) where blah is whatever block you want the stairs to be made out of. Like, if you wanted a mob spawner staircase (wtf?) you'd make it = new BlockStairs (99, Block.mobSpawner)
So I'm trying to make some custom stairs, and I get this error:
src\minecraft\net\minecraft\src\mod_MyMod.java:9: cannot find symbol
symbol : constructor BlockStairs(int,int)
location: class net.minecraft.src.BlockStairs
stairMyStair = new BlockStairs(99, 0).setBlockName("stairMyStair");
The is the piece of the code that causes the problem:
public static final Block stairMyStair;
static
{
stairMyStair = new BlockStairs(99, 0).setBlockName("stairMyStair");
}
package net.minecraft.src;
import java.util.Random;
public class BlockMyBlock extends Block {
protected BlockMyBlock(int i, int j) {
super(i, j, Material.rock);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
super.updateTick(world, i, j, k, random);
System.out.println("running update tick");
EntityPlayer player = world.getClosestPlayer(i, j, k, 0);
int range = 5;
if(player.posX > i - range && player.posX < i + range)
{
if(player.posY > i - range && player.posY < i + range)
{
if(player.posZ > i - range && player.posZ < i + range)
{
System.out.println("Do this");
}
}
}
}
Nope, still nothing.
Maybe one of you guys could try doing this yourselves? If it's not too much trouble; I just really want to solve this mystery now.
Nope, updateTick doen't seem to be running. This is what BlockMyBlock looks like:
package net.minecraft.src;
import java.util.Random;
public class BlockMyBlock extends Block {
protected BlockMyBlock(int i, int j) {
super(i, j, Material.rock);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
System.out.println("running update tick");
EntityPlayer player = world.getClosestPlayer(i, j, k, 0);
int range = 5;
if(player.posX > i - range || player.posX < i + range)
{
if(player.posY > i - range || player.posY < i + range)
{
if(player.posZ > i - range || player.posZ < i + range)
{
System.out.println("Do this");
}
}
}
}
}
And this is what mod_MyMod looks like:
package net.minecraft.src;
import java.util.Random;
public class mod_MyMod extends BaseMod{
public static final Block MyBlock = new BlockMyBlock(98, 0) .setHardness(2.0F) .setResistance(10F) .setLightValue(0.9F) .setBlockName("My Block");
public mod_MyMod(){
ModLoader.RegisterBlock(MyBlock);
MyBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/MyBlock.png");
ModLoader.AddName(MyBlock, "My Block");
ModLoader.AddRecipe(new ItemStack(MyBlock, 10), new Object[] {
"##", "##", Character.valueOf('#'), Item.stick,
});
}
public String Version() {
return "1.6.6";
}
}
your iff statements are only going to evaluate for true if the player is simulteously on one side of the black and on the other. use || instead of &&.
I see what you mean, but I still don't heal when I am around the block.
package net.minecraft.src;
import java.util.Random;
public class BlockMyBlock extends Block {
protected BlockMyBlock(int i, int j) {
super(i, j, Material.rock);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
EntityPlayer player = world.getClosestPlayer(i, j, k, 0);
int range = 5;
if(player.posX > i - range || player.posX < i + range)
{
if(player.posY > i - range || player.posY < i + range)
{
if(player.posZ > i - range || player.posZ < i + range)
{
player.heal(1);
}
}
}
}
}
Thank you for your patience with me, I truly appreciate it.
package net.minecraft.src;
import java.util.Random;
public class BlockMyBlock extends Block {
protected BlockMyBlock(int i, int j) {
super(i, j, Material.rock);
}
public void updateTick(World world, int i, int j, int k, Random random)
{
EntityPlayer player = world.getClosestPlayer(i, j, k, 0);
int range = 5;
if(player.posX > i - range && player.posX < i + range)
{
if(player.posY > i - range && player.posY < i + range)
{
if(player.posZ > i - range && player.posZ < i + range)
{
player.heal(1);
}
}
}
}
}
...But I don't gain health when I am around the block. What am I doing wrong?
0
Otherwise, awesome mod!
0
0
0
Yes.
0
It's not hacked, it's the most recent snapshot.
0
Any help at all would be appreciated.
0
Thank you.
0
The is the piece of the code that causes the problem:
Where did I mess up?
0
Nope, still nothing.
Maybe one of you guys could try doing this yourselves? If it's not too much trouble; I just really want to solve this mystery now.
0
0
Any ideas?
0
And this is what mod_MyMod looks like:
0
0
I see what you mean, but I still don't heal when I am around the block.
Thank you for your patience with me, I truly appreciate it.
0
Alright, It recompiled without a problem:
...But I don't gain health when I am around the block. What am I doing wrong?