You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
154 lines
4.6 KiB
Java
154 lines
4.6 KiB
Java
package net.minecraft.block;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import java.util.List;
|
|
import java.util.Random;
|
|
import net.minecraft.block.material.MapColor;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.tileentity.TileEntityEndPortal;
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
|
|
public class BlockEndPortal extends BlockContainer
|
|
{
|
|
public static boolean field_149948_a;
|
|
private static final String __OBFID = "CL_00000236";
|
|
|
|
protected BlockEndPortal(Material p_i45404_1_)
|
|
{
|
|
super(p_i45404_1_);
|
|
this.setLightLevel(1.0F);
|
|
}
|
|
|
|
/**
|
|
* Returns a new instance of a block's tile entity class. Called on placing the block.
|
|
*/
|
|
public TileEntity createNewTileEntity(World worldIn, int meta)
|
|
{
|
|
return new TileEntityEndPortal();
|
|
}
|
|
|
|
/**
|
|
* Updates the blocks bounds based on its current state. Args: world, x, y, z
|
|
*/
|
|
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, int x, int y, int z)
|
|
{
|
|
float f = 0.0625F;
|
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
*/
|
|
@SideOnly(Side.CLIENT)
|
|
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side)
|
|
{
|
|
return side != 0 ? false : super.shouldSideBeRendered(worldIn, x, y, z, side);
|
|
}
|
|
|
|
/**
|
|
* Adds all intersecting collision boxes to a list. (Be sure to only add boxes to the list if they intersect the
|
|
* mask.) Parameters: World, X, Y, Z, mask, list, colliding entity
|
|
*/
|
|
public void addCollisionBoxesToList(World worldIn, int x, int y, int z, AxisAlignedBB mask, List list, Entity collider) {}
|
|
|
|
/**
|
|
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
|
|
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
|
|
*/
|
|
public boolean isOpaqueCube()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)
|
|
*/
|
|
public boolean renderAsNormalBlock()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Returns the quantity of items to drop on block destruction.
|
|
*/
|
|
public int quantityDropped(Random random)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/**
|
|
* Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
|
|
*/
|
|
public void onEntityCollidedWithBlock(World worldIn, int x, int y, int z, Entity entityIn)
|
|
{
|
|
if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && !worldIn.isRemote)
|
|
{
|
|
entityIn.travelToDimension(1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* A randomly called display update to be able to add particles or other items for display
|
|
*/
|
|
@SideOnly(Side.CLIENT)
|
|
public void randomDisplayTick(World worldIn, int x, int y, int z, Random random)
|
|
{
|
|
double d0 = (double)((float)x + random.nextFloat());
|
|
double d1 = (double)((float)y + 0.8F);
|
|
double d2 = (double)((float)z + random.nextFloat());
|
|
double d3 = 0.0D;
|
|
double d4 = 0.0D;
|
|
double d5 = 0.0D;
|
|
worldIn.spawnParticle("smoke", d0, d1, d2, d3, d4, d5);
|
|
}
|
|
|
|
/**
|
|
* The type of render function that is called for this block
|
|
*/
|
|
public int getRenderType()
|
|
{
|
|
return -1;
|
|
}
|
|
|
|
/**
|
|
* Called whenever the block is added into the world. Args: world, x, y, z
|
|
*/
|
|
public void onBlockAdded(World worldIn, int x, int y, int z)
|
|
{
|
|
if (!field_149948_a)
|
|
{
|
|
if (worldIn.provider.dimensionId != 0)
|
|
{
|
|
worldIn.setBlockToAir(x, y, z);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Gets an item for the block being called on. Args: world, x, y, z
|
|
*/
|
|
@SideOnly(Side.CLIENT)
|
|
public Item getItem(World worldIn, int x, int y, int z)
|
|
{
|
|
return Item.getItemById(0);
|
|
}
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister reg)
|
|
{
|
|
this.blockIcon = reg.registerIcon("portal");
|
|
}
|
|
|
|
public MapColor getMapColor(int meta)
|
|
{
|
|
return MapColor.obsidianColor;
|
|
}
|
|
} |