somarni

Untitled

Jul 27th, 2014
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.80 KB | None | 0 0
  1. package somarani.soulcraft.block;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.block.material.Material;
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.entity.Entity;
  7. import net.minecraft.entity.effect.EntityLightningBolt;
  8. import net.minecraft.entity.item.EntityItem;
  9. import net.minecraft.entity.player.EntityPlayer;
  10. import net.minecraft.init.Blocks;
  11. import net.minecraft.item.Item;
  12. import net.minecraft.item.ItemStack;
  13. import net.minecraft.util.AxisAlignedBB;
  14. import net.minecraft.util.Facing;
  15. import net.minecraft.world.IBlockAccess;
  16. import net.minecraft.world.World;
  17. import somarani.soulcraft.common.SoulCraft;
  18. import somarani.soulcraft.mobboss.EntitySoulBossMob;
  19. import cpw.mods.fml.common.registry.GameRegistry;
  20. import cpw.mods.fml.relauncher.Side;
  21. import cpw.mods.fml.relauncher.SideOnly;
  22.  
  23. public class BlockSoulGlass extends Block {
  24.  
  25. public static boolean skull = false;
  26. public static boolean spider = false;
  27. public static boolean creeper = false;
  28. public static boolean zombie = false;
  29. public static boolean shouldSpawn = false;
  30.  
  31. public BlockSoulGlass(Material p_i45394_1_) {
  32. super(p_i45394_1_);
  33.  
  34. setHardness(2f);
  35. setResistance(5f);
  36. setBlockName("soulglass");
  37. setCreativeTab(SoulCraft.tabSoul);
  38. setLightLevel(0f);
  39. setBlockTextureName("soulcraft:soulglass");
  40.  
  41. GameRegistry.registerBlock(this, "soulglass");
  42.  
  43. }
  44.  
  45. @SideOnly(Side.CLIENT)
  46. public void addInformation(ItemStack par1ItemStack,
  47. EntityPlayer par2EntityPlayer, java.util.List par3List, boolean par4) {
  48.  
  49. par3List.add("Allows ONLY players to walk right through");
  50.  
  51. }
  52.  
  53. @SideOnly(Side.CLIENT)
  54. public boolean shouldSideBeRendered(IBlockAccess p_149646_1_,
  55. int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
  56. Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_,
  57. p_149646_4_);
  58.  
  59. if (this == SoulCraft.soulGlass) {
  60. if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_,
  61. p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_
  62. - Facing.offsetsXForSide[p_149646_5_], p_149646_3_
  63. - Facing.offsetsYForSide[p_149646_5_], p_149646_4_
  64. - Facing.offsetsZForSide[p_149646_5_])) {
  65. return true;
  66. }
  67.  
  68. if (block == this) {
  69. return false;
  70. }
  71. }
  72.  
  73. return true;
  74. }
  75.  
  76. @SideOnly(Side.CLIENT)
  77. public int getRenderBlockPass() {
  78. return 0;
  79. }
  80.  
  81. @SideOnly(Side.CLIENT)
  82. public boolean isOpaqueCube() {
  83. return false;
  84. }
  85.  
  86. public void onEntityCollidedWithBlock(World p_149670_1_, int x,
  87. int y, int z, Entity entity) {
  88. if (!(entity instanceof EntityPlayer)) {
  89. entity.setDead();
  90. }
  91.  
  92. System.out.println(entity);
  93. if (entity instanceof EntityItem) {
  94. if (entity.toString().contains("spideressence")) {
  95. spider = true;
  96. }
  97.  
  98. if (entity.toString().contains("bonehelmet")) {
  99. skull = true;
  100. }
  101. if (entity.toString().contains("creeperessence")) {
  102. creeper = true;
  103. }
  104.  
  105. if (entity.toString().contains("zombieeessence")) {
  106. zombie = true;
  107. }
  108.  
  109. if(spider && skull && creeper && zombie){
  110.  
  111. shouldSpawn = true;
  112.  
  113. EntitySoulBossMob mob = new EntitySoulBossMob(Minecraft.getMinecraft().theWorld);
  114.  
  115. mob.posX = x + 2;
  116. mob.posY = y;
  117. mob.posZ = z + 2;
  118.  
  119. Minecraft.getMinecraft().theWorld.spawnEntityInWorld(new EntityLightningBolt(Minecraft.getMinecraft().theWorld, x, y, z));
  120. Minecraft.getMinecraft().theWorld.spawnEntityInWorld(mob);
  121. Minecraft.getMinecraft().theWorld.setBlockToAir(x, y, z);
  122. Minecraft.getMinecraft().theWorld.setBlock(x, y, z, Blocks.diamond_block); // for testing purposes.
  123.  
  124. }
  125.  
  126.  
  127. }
  128.  
  129. }
  130.  
  131. public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World,
  132. int par2, int par3, int par4) {
  133. return null;
  134. }
  135.  
  136. public boolean renderAsNormalBlock() {
  137. return false;
  138. }
  139.  
  140. }
Advertisement
Add Comment
Please, Sign In to add comment