2013-04-17 02:48:49 +02:00
|
|
|
package StevenDimDoors.mod_pocketDim.blocks;
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-07-25 23:25:43 +02:00
|
|
|
import java.util.Random;
|
|
|
|
|
2013-02-18 03:46:16 +01:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.block.material.Material;
|
2013-03-29 23:19:27 +01:00
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-05-29 07:22:50 +02:00
|
|
|
import net.minecraft.util.Icon;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-07-25 23:25:43 +02:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
import StevenDimDoors.mod_pocketDim.LimboDecay;
|
2013-07-16 23:52:26 +02:00
|
|
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-02-18 03:46:16 +01:00
|
|
|
|
|
|
|
public class BlockLimbo extends Block
|
|
|
|
{
|
2013-07-25 23:25:43 +02:00
|
|
|
private final int limboDimensionID;
|
2013-07-26 11:15:44 +02:00
|
|
|
private final LimboDecay decay;
|
2013-07-25 23:25:43 +02:00
|
|
|
|
2013-07-26 11:15:44 +02:00
|
|
|
public BlockLimbo(int i, int j, Material par2Material, int limboDimensionID, LimboDecay decay)
|
2013-02-18 03:46:16 +01:00
|
|
|
{
|
2013-07-25 06:12:13 +02:00
|
|
|
super(i, Material.ground);
|
2013-07-25 23:25:43 +02:00
|
|
|
this.limboDimensionID = limboDimensionID;
|
2013-07-26 11:15:44 +02:00
|
|
|
this.decay = decay;
|
2013-07-25 23:25:43 +02:00
|
|
|
this.setTickRandomly(true);
|
|
|
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|
2013-03-29 23:19:27 +01:00
|
|
|
|
2013-07-25 06:12:13 +02:00
|
|
|
/**
|
|
|
|
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
|
|
|
*/
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
@Override
|
|
|
|
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
|
|
|
|
{
|
|
|
|
return this.getIcon(side, blockAccess.getBlockMetadata(x, y, z));
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-07-25 06:12:13 +02:00
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
|
|
|
this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
|
2013-07-25 06:12:13 +02:00
|
|
|
@Override
|
|
|
|
public Icon getIcon(int par1, int par2)
|
|
|
|
{
|
|
|
|
return this.blockIcon;
|
|
|
|
}
|
2013-07-25 23:25:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* If the block is in Limbo, attempt to decay surrounding blocks upon receiving a random update tick.
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public void updateTick(World world, int x, int y, int z, Random random)
|
|
|
|
{
|
|
|
|
//Make sure this block is in Limbo
|
|
|
|
if (world.provider.dimensionId == limboDimensionID)
|
|
|
|
{
|
2013-07-26 11:15:44 +02:00
|
|
|
decay.applySpreadDecay(world, x, y, z);
|
2013-07-25 23:25:43 +02:00
|
|
|
}
|
|
|
|
}
|
2013-02-18 03:46:16 +01:00
|
|
|
}
|