1

MODDING HELP

glowdemon1 4/6/13 10:53 pm
248
4/7/2013 8:06 am
I tried to give my custom liquid a colour, but this did not work out, I searched everywhere and tried most methods, is anyone able to help me out ? I'm trying to make it a little bit grey-ish. Also in the creative tab, both liquids appear with the same name, I haven't figured out what caused this yet. Here are the codes :

mod_ApplesLiquid
Click to reveal
package net.minecraft.src;
import java.util.Random;

public class mod_ApplesLiquid extends mod_ApplesPlusPlus
{

public static final BlockFluid liquidi = (BlockFluid)(new BlockFlowing(350, Material.water)).setHardness(100.0F).setLightOpacity(3).getIndirectPowerOutput("water").disableStats();
public static final Block liquidis = (new BlockStationary(351, Material.water)).setHardness(100.0F).setLightOpacity(3).getIndirectPowerOutput("water").disableStats();

public void load()
{

ModLoader.registerBlock(liquidis);
ModLoader.addName(liquidis, "Stationary invisibility water");
ModLoader.registerBlock(liquidi);
ModLoader.addName(liquidi, "Flowing invisibility water");





liquidis.setCreativeTab(CreativeTabs.tabMisc);
liquidi.setCreativeTab(CreativeTabs.tabMisc);



}
public String getVersion()
{
return "3.14159265";
}
}


BlockFlowingLiquidIS
Click to reveal
package net.minecraft.src;

import java.util.Random;

public class BlockFlowingLiquidIS extends BlockFluid
{
protected BlockFlowingLiquidIS(int par1, Material par2Material)
{
super(par1, par2Material);
this.setTickRandomly(false);

if (par2Material == Material.lava)
{
this.setTickRandomly(true);
}
}
public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
{
return 0XF72E64;
}

public int getBlockColor()
{
return 0XF72E64;
}
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return this.blockMaterial != Material.lava;
}
public String getTextureFile(){
return "/textures/blocks/liquidi";
}
/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);

if (par1World.getBlockId(par2, par3, par4) == this.blockID)
{
this.setNotStationary(par1World, par2, par3, par4);
}
}

/**
* Changes the block ID to that of an updating fluid.
*/
private void setNotStationary(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlock(par2, par3, par4, this.blockID - 1, var5, 2);
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID - 1, this.tickRate(par1World));
}

/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (this.blockMaterial == Material.lava)
{
int var6 = par5Random.nextInt(3);
int var7;
int var8;

for (var7 = 0; var7 < var6; ++var7)
{
par2 += par5Random.nextInt(3) - 1;
++par3;
par4 += par5Random.nextInt(3) - 1;
var8 = par1World.getBlockId(par2, par3, par4);

if (var8 == 0)
{
if (this.isFlammable(par1World, par2 - 1, par3, par4) || this.isFlammable(par1World, par2 + 1, par3, par4) || this.isFlammable(par1World, par2, par3, par4 - 1) || this.isFlammable(par1World, par2, par3, par4 + 1) || this.isFlammable(par1World, par2, par3 - 1, par4) || this.isFlammable(par1World, par2, par3 + 1, par4))
{
par1World.setBlock(par2, par3, par4, Block.fire.blockID);
return;
}
}
else if (Block.blocksList[var8].blockMaterial.blocksMovement())
{
return;
}
}

if (var6 == 0)
{
var7 = par2;
var8 = par4;

for (int var9 = 0; var9 < 3; ++var9)
{
par2 = var7 + par5Random.nextInt(3) - 1;
par4 = var8 + par5Random.nextInt(3) - 1;

if (par1World.isAirBlock(par2, par3 + 1, par4) && this.isFlammable(par1World, par2, par3, par4))
{
par1World.setBlock(par2, par3 + 1, par4, Block.fire.blockID);
}
}
}
}
}

/**
* Checks to see if the block is flammable.
*/
private boolean isFlammable(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3, par4).getCanBurn();
}
}


BlockStationaryLiquidI

Click to reveal
package net.minecraft.src;

import java.util.Random;

public class BlockStationaryLiquidI extends BlockFluid
{
protected BlockStationaryLiquidI(int par1, Material par2Material)
{
super(par1, par2Material);
this.setTickRandomly(false);

if (par2Material == Material.lava)
{
this.setTickRandomly(true);
}
}

public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return this.blockMaterial != Material.lava;
}

/**
* Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are
* their own) Args: x, y, z, neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
super.onNeighborBlockChange(par1World, par2, par3, par4, par5);

if (par1World.getBlockId(par2, par3, par4) == this.blockID)
{
this.setNotStationary(par1World, par2, par3, par4);
}
}

/**
* Changes the block ID to that of an updating fluid.
*/
private void setNotStationary(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockMetadata(par2, par3, par4);
par1World.setBlock(par2, par3, par4, this.blockID - 1, var5, 2);
par1World.scheduleBlockUpdate(par2, par3, par4, this.blockID - 1, this.tickRate(par1World));
}

/**
* Ticks the block if it's been scheduled
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
if (this.blockMaterial == Material.lava)
{
int var6 = par5Random.nextInt(3);
int var7;
int var8;

for (var7 = 0; var7 < var6; ++var7)
{
par2 += par5Random.nextInt(3) - 1;
++par3;
par4 += par5Random.nextInt(3) - 1;
var8 = par1World.getBlockId(par2, par3, par4);

if (var8 == 0)
{
if (this.isFlammable(par1World, par2 - 1, par3, par4) || this.isFlammable(par1World, par2 + 1, par3, par4) || this.isFlammable(par1World, par2, par3, par4 - 1) || this.isFlammable(par1World, par2, par3, par4 + 1) || this.isFlammable(par1World, par2, par3 - 1, par4) || this.isFlammable(par1World, par2, par3 + 1, par4))
{
par1World.setBlock(par2, par3, par4, Block.fire.blockID);
return;
}
}
else if (Block.blocksList[var8].blockMaterial.blocksMovement())
{
return;
}
}

if (var6 == 0)
{
var7 = par2;
var8 = par4;

for (int var9 = 0; var9 < 3; ++var9)
{
par2 = var7 + par5Random.nextInt(3) - 1;
par4 = var8 + par5Random.nextInt(3) - 1;

if (par1World.isAirBlock(par2, par3 + 1, par4) && this.isFlammable(par1World, par2, par3, par4))
{
par1World.setBlock(par2, par3 + 1, par4, Block.fire.blockID);
}
}
}
}
}

/**
* Checks to see if the block is flammable.
*/
private boolean isFlammable(World par1World, int par2, int par3, int par4)
{
return par1World.getBlockMaterial(par2, par3, par4).getCanBurn();
}
}
Posted by
glowdemon1
Level 23 : Expert Miner
0

  Have something to say?

JoinSign in

2

ehdfawq3er
04/07/2013 6:07 am
Level 61 : High Grandmaster Modder
As alwaya, I recommand switching to forge.
Add .setUnlocalizedName("name") to both blocks. I dunno about the colors though, haven't made liquids by myself yet.
1
glowdemon1
04/07/2013 8:06 am
Level 23 : Expert Miner
I considered switching to forge but yea.
1

Welcome