BiomesOPlenty/common/biomesoplenty/blocks/BlockCloud.java

93 lines
2.5 KiB
Java
Raw Normal View History

package biomesoplenty.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
2013-05-11 07:48:02 +00:00
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.Items;
2013-05-11 07:48:02 +00:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockCloud extends Block
{
2013-05-31 10:34:02 +00:00
public BlockCloud(int par1)
{
super(par1, Material.sponge);
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
blockIcon = par1IconRegister.registerIcon("biomesoplenty:cloud");
}
2013-05-31 10:34:02 +00:00
/**
* Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been
* cleared to be reused)
*/
@Override
2013-05-31 10:34:02 +00:00
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
float var5 = 0.25F;
return AxisAlignedBB.getAABBPool().getAABB(par2, par3, par4, par2 + 1, par3 + 1 - var5, par4 + 1);
}
/**
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
*/
@Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
par5Entity.fallDistance = 0.0F;
if (par5Entity instanceof EntityPlayer)
{
InventoryPlayer inventory = ((EntityPlayer)par5Entity).inventory;
if (inventory.armorInventory[0] != null && inventory.armorInventory[0].itemID == Items.wadingBoots.get().itemID)
{
return;
}
}
2013-05-31 10:34:02 +00:00
par5Entity.motionX *= 0.8D;
par5Entity.motionZ *= 0.8D;
}
2013-05-31 10:34:02 +00:00
@Override
@SideOnly(Side.CLIENT)
/**
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
*/
public int getRenderBlockPass()
{
return 1;
}
@Override
2013-05-11 07:48:02 +00:00
public boolean isOpaqueCube()
2013-05-31 10:34:02 +00:00
{
return false;
}
@Override
2013-05-31 10:34:02 +00:00
@SideOnly(Side.CLIENT)
2013-05-31 10:34:02 +00:00
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
return true;//super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, 1 - par5);
}
}