2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.block;
|
2015-10-30 21:20:23 -07:00
|
|
|
|
2015-11-02 12:39:44 -08:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
2015-11-02 17:45:11 -08:00
|
|
|
import WayofTime.bloodmagic.api.BlockStack;
|
2015-11-28 18:25:46 -08:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2015-11-02 17:45:11 -08:00
|
|
|
import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
|
2015-11-17 15:52:31 -08:00
|
|
|
import WayofTime.bloodmagic.block.base.BlockStringContainer;
|
2015-11-02 17:45:11 -08:00
|
|
|
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
|
2015-11-02 13:20:29 -08:00
|
|
|
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
|
2015-10-30 21:20:23 -07:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2015-10-31 17:58:47 -07:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2015-10-30 21:20:23 -07:00
|
|
|
import net.minecraft.util.BlockPos;
|
2015-11-02 17:45:11 -08:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2015-10-30 21:20:23 -07:00
|
|
|
import net.minecraft.world.World;
|
|
|
|
|
2015-11-17 15:52:31 -08:00
|
|
|
public class BlockRitualController extends BlockStringContainer {
|
2015-10-30 21:20:23 -07:00
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
public static final String[] names = {"master", "imperfect"};
|
2015-10-30 21:20:23 -07:00
|
|
|
|
2015-10-31 13:47:43 -07:00
|
|
|
public BlockRitualController() {
|
2015-11-17 15:52:31 -08:00
|
|
|
super(Material.rock, names);
|
2015-10-30 21:20:23 -07:00
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
setUnlocalizedName(Constants.Mod.MODID + ".stone.ritual.");
|
2015-11-02 12:39:44 -08:00
|
|
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
2015-10-30 21:20:23 -07:00
|
|
|
setStepSound(soundTypeStone);
|
|
|
|
setHardness(2.0F);
|
2015-11-02 19:18:53 -08:00
|
|
|
setResistance(5.0F);
|
2015-10-30 21:20:23 -07:00
|
|
|
setHarvestLevel("pickaxe", 2);
|
|
|
|
}
|
|
|
|
|
2015-11-02 17:45:11 -08:00
|
|
|
@Override
|
|
|
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
|
|
|
TileEntity tile = world.getTileEntity(pos);
|
|
|
|
|
|
|
|
if (getMetaFromState(state) == 1 && tile instanceof TileImperfectRitualStone) {
|
|
|
|
|
|
|
|
IBlockState determinerState = world.getBlockState(pos.up());
|
|
|
|
BlockStack determiner = new BlockStack(determinerState.getBlock(), determinerState.getBlock().getMetaFromState(determinerState));
|
|
|
|
|
|
|
|
return ((TileImperfectRitualStone) tile).performRitual(world, pos, ImperfectRitualRegistry.getRitualForBlock(determiner), player);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-10-31 17:58:47 -07:00
|
|
|
@Override
|
|
|
|
public TileEntity createNewTileEntity(World world, int meta) {
|
2015-11-02 17:45:11 -08:00
|
|
|
return meta == 0 ? new TileMasterRitualStone() : new TileImperfectRitualStone();
|
2015-10-31 17:58:47 -07:00
|
|
|
}
|
2015-10-30 21:20:23 -07:00
|
|
|
}
|