mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-21 12:42:50 +00:00
77 lines
2.4 KiB
Java
77 lines
2.4 KiB
Java
/**
|
|
* This class was created by <Vazkii>. It's distributed as
|
|
* part of the Botania Mod. Get the Source Code in github:
|
|
* https://github.com/Vazkii/Botania
|
|
*
|
|
* Botania is Open Source and distributed under the
|
|
* Botania License: http://botaniamod.net/license.php
|
|
*
|
|
* File Created @ [Jun 9, 2014, 7:17:46 PM (GMT)]
|
|
*/
|
|
package vazkii.botania.common.block;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.IIcon;
|
|
import net.minecraft.world.IBlockAccess;
|
|
import net.minecraft.world.World;
|
|
import vazkii.botania.api.lexicon.ILexiconable;
|
|
import vazkii.botania.api.lexicon.LexiconEntry;
|
|
import vazkii.botania.api.wand.IWandable;
|
|
import vazkii.botania.client.core.helper.IconHelper;
|
|
import vazkii.botania.common.achievement.ModAchievements;
|
|
import vazkii.botania.common.block.tile.TileAlfPortal;
|
|
import vazkii.botania.common.lexicon.LexiconData;
|
|
import vazkii.botania.common.lib.LibBlockNames;
|
|
|
|
public class BlockAlfPortal extends BlockModContainer<TileAlfPortal> implements IWandable, ILexiconable {
|
|
|
|
IIcon iconOff, iconOn;
|
|
public static IIcon portalTex;
|
|
|
|
public BlockAlfPortal() {
|
|
super(Material.wood);
|
|
setHardness(10F);
|
|
setStepSound(soundTypeWood);
|
|
setBlockName(LibBlockNames.ALF_PORTAL);
|
|
}
|
|
|
|
@Override
|
|
public void registerBlockIcons(IIconRegister register) {
|
|
iconOff = IconHelper.forBlock(register, this, 0);
|
|
iconOn = IconHelper.forBlock(register, this, 1);
|
|
portalTex = IconHelper.forBlock(register, this, "Inside");
|
|
}
|
|
|
|
@Override
|
|
public IIcon getIcon(int side, int meta) {
|
|
return meta == 0 ? iconOff : iconOn;
|
|
}
|
|
|
|
@Override
|
|
public TileAlfPortal createNewTileEntity(World world, int meta) {
|
|
return new TileAlfPortal();
|
|
}
|
|
|
|
@Override
|
|
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
|
return LexiconData.alfhomancyIntro;
|
|
}
|
|
|
|
@Override
|
|
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
|
|
boolean did = ((TileAlfPortal) world.getTileEntity(x, y, z)).onWanded();
|
|
if(did && player != null)
|
|
player.addStat(ModAchievements.elfPortalOpen, 1);
|
|
return did;
|
|
}
|
|
|
|
@Override
|
|
public int getLightValue(IBlockAccess world, int x, int y, int z) {
|
|
return world.getBlockMetadata(x, y, z) == 0 ? 0 : 15;
|
|
}
|
|
|
|
}
|