Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package somarani.soulcraft.block;
- import net.minecraft.block.Block;
- import net.minecraft.block.material.Material;
- import net.minecraft.client.Minecraft;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.effect.EntityLightningBolt;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Blocks;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.util.AxisAlignedBB;
- import net.minecraft.util.Facing;
- import net.minecraft.world.IBlockAccess;
- import net.minecraft.world.World;
- import somarani.soulcraft.common.SoulCraft;
- import somarani.soulcraft.mobboss.EntitySoulBossMob;
- import cpw.mods.fml.common.registry.GameRegistry;
- import cpw.mods.fml.relauncher.Side;
- import cpw.mods.fml.relauncher.SideOnly;
- public class BlockSoulGlass extends Block {
- public static boolean skull = false;
- public static boolean spider = false;
- public static boolean creeper = false;
- public static boolean zombie = false;
- public static boolean shouldSpawn = false;
- public BlockSoulGlass(Material p_i45394_1_) {
- super(p_i45394_1_);
- setHardness(2f);
- setResistance(5f);
- setBlockName("soulglass");
- setCreativeTab(SoulCraft.tabSoul);
- setLightLevel(0f);
- setBlockTextureName("soulcraft:soulglass");
- GameRegistry.registerBlock(this, "soulglass");
- }
- @SideOnly(Side.CLIENT)
- public void addInformation(ItemStack par1ItemStack,
- EntityPlayer par2EntityPlayer, java.util.List par3List, boolean par4) {
- par3List.add("Allows ONLY players to walk right through");
- }
- @SideOnly(Side.CLIENT)
- public boolean shouldSideBeRendered(IBlockAccess p_149646_1_,
- int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
- Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_,
- p_149646_4_);
- if (this == SoulCraft.soulGlass) {
- if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_,
- p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_
- - Facing.offsetsXForSide[p_149646_5_], p_149646_3_
- - Facing.offsetsYForSide[p_149646_5_], p_149646_4_
- - Facing.offsetsZForSide[p_149646_5_])) {
- return true;
- }
- if (block == this) {
- return false;
- }
- }
- return true;
- }
- @SideOnly(Side.CLIENT)
- public int getRenderBlockPass() {
- return 0;
- }
- @SideOnly(Side.CLIENT)
- public boolean isOpaqueCube() {
- return false;
- }
- public void onEntityCollidedWithBlock(World p_149670_1_, int x,
- int y, int z, Entity entity) {
- if (!(entity instanceof EntityPlayer)) {
- entity.setDead();
- }
- System.out.println(entity);
- if (entity instanceof EntityItem) {
- if (entity.toString().contains("spideressence")) {
- spider = true;
- }
- if (entity.toString().contains("bonehelmet")) {
- skull = true;
- }
- if (entity.toString().contains("creeperessence")) {
- creeper = true;
- }
- if (entity.toString().contains("zombieeessence")) {
- zombie = true;
- }
- if(spider && skull && creeper && zombie){
- shouldSpawn = true;
- EntitySoulBossMob mob = new EntitySoulBossMob(Minecraft.getMinecraft().theWorld);
- mob.posX = x + 2;
- mob.posY = y;
- mob.posZ = z + 2;
- Minecraft.getMinecraft().theWorld.spawnEntityInWorld(new EntityLightningBolt(Minecraft.getMinecraft().theWorld, x, y, z));
- Minecraft.getMinecraft().theWorld.spawnEntityInWorld(mob);
- Minecraft.getMinecraft().theWorld.setBlockToAir(x, y, z);
- Minecraft.getMinecraft().theWorld.setBlock(x, y, z, Blocks.diamond_block); // for testing purposes.
- }
- }
- }
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World,
- int par2, int par3, int par4) {
- return null;
- }
- public boolean renderAsNormalBlock() {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment