mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-23 13:40:11 +00:00
94 lines
2.7 KiB
Java
94 lines
2.7 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 @ [Aug 28, 2015, 5:18:13 PM (GMT)]
|
|
*/
|
|
package vazkii.botania.common.block.mana;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.EntityLivingBase;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.util.IIcon;
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.world.World;
|
|
import vazkii.botania.api.lexicon.ILexiconable;
|
|
import vazkii.botania.api.lexicon.LexiconEntry;
|
|
import vazkii.botania.client.lib.LibRenderIDs;
|
|
import vazkii.botania.common.block.BlockModContainer;
|
|
import vazkii.botania.common.block.ModBlocks;
|
|
import vazkii.botania.common.block.tile.mana.TileBellows;
|
|
import vazkii.botania.common.entity.EntityDoppleganger;
|
|
import vazkii.botania.common.lexicon.LexiconData;
|
|
import vazkii.botania.common.lib.LibBlockNames;
|
|
|
|
public class BlockBellows extends BlockModContainer<TileBellows> implements ILexiconable {
|
|
|
|
private static final int[] META_ROTATIONS = new int[] { 3, 4, 2, 5 };
|
|
|
|
public BlockBellows() {
|
|
super(Material.wood);
|
|
setHardness(2.0F);
|
|
setStepSound(soundTypeWood);
|
|
setBlockName(LibBlockNames.BELLOWS);
|
|
|
|
float f = (1F - 10 / 16F) / 2F;
|
|
setBlockBounds(f, 0F, f, 1F - f, 10F / 16F, 1F - f);
|
|
}
|
|
|
|
@Override
|
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemIn) {
|
|
int l = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
|
world.setBlockMetadataWithNotify(x, y, z, META_ROTATIONS[l], 2);
|
|
}
|
|
|
|
@Override
|
|
public void registerBlockIcons(IIconRegister register) {
|
|
// NO-OP
|
|
}
|
|
|
|
@Override
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int s, float xs, float ys, float zs) {
|
|
if(EntityDoppleganger.isTruePlayer(player))
|
|
((TileBellows) world.getTileEntity(x, y, z)).interact();
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isOpaqueCube() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean renderAsNormalBlock() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public IIcon getIcon(int side, int meta) {
|
|
return ModBlocks.livingwood.getIcon(side, 0);
|
|
}
|
|
|
|
@Override
|
|
public int getRenderType() {
|
|
return LibRenderIDs.idBellows;
|
|
}
|
|
|
|
@Override
|
|
public TileBellows createNewTileEntity(World world, int meta) {
|
|
return new TileBellows();
|
|
}
|
|
|
|
@Override
|
|
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
|
return LexiconData.bellows;
|
|
}
|
|
|
|
}
|