BiomesOPlenty/src/minecraft/biomesoplenty/blocks/BlockPromisedPortal.java
Amnet d87db66d6a Fixed spawning in the promised land.
Switched back top of the high grass to its metadata.
2013-05-08 15:39:07 +02:00

88 lines
2.9 KiB
Java

package biomesoplenty.blocks;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.configuration.BOPConfiguration;
import biomesoplenty.helpers.TeleporterPromised;
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.EntityPlayerMP;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPromisedPortal extends Block
{
public BlockPromisedPortal(int par1)
{
super(par1, Material.portal);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.blockIcon = par1IconRegister.registerIcon("BiomesOPlenty:portal");
}
@SideOnly(Side.CLIENT)
/**
* Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
*/
public int getRenderBlockPass()
{
return 1;
}
@SideOnly(Side.CLIENT)
/**
* 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 super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, 1 - par5);
}
/**
* 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)
*/
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
{
return null;
}
/**
* 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;
}
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
{
if (par5Entity.ridingEntity == null && par5Entity.riddenByEntity == null)
{
if (par5Entity instanceof EntityPlayerMP)
{
EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity;
if (par5Entity.dimension != BOPConfiguration.promisedLandDimID)
{
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, BOPConfiguration.promisedLandDimID, new TeleporterPromised(thePlayer.mcServer.worldServerForDimension(BOPConfiguration.promisedLandDimID)));
}
else
{
thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterPromised(thePlayer.mcServer.worldServerForDimension(0)));
}
}
}
}
}