public void startExecuting() { if (!this.field_179484_c) { super.startExecuting(); } else { World world = this.field_179485_a.worldObj; BlockPos blockpos = (new BlockPos(this.field_179485_a.posX, this.field_179485_a.posY + 0.5D, this.field_179485_a.posZ)).offset(this.facing); IBlockState iblockstate = world.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { world.setBlockState(blockpos, Blocks.monster_egg.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3); this.field_179485_a.spawnExplosionParticle(); this.field_179485_a.setDead(); } } }
public void startExecuting() { if (!this.doMerge) { super.startExecuting(); } else { World world = this.entity.world; BlockPos blockpos = (new BlockPos(this.entity.posX, this.entity.posY + 0.5D, this.entity.posZ)).offset(this.facing); IBlockState iblockstate = world.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { world.setBlockState(blockpos, Blocks.MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3); this.entity.spawnExplosionParticle(); this.entity.setDead(); } } }
/** * Execute a one shot task or start executing a continuous task */ public void startExecuting() { if (!this.doMerge) { super.startExecuting(); } else { World world = this.silverfish.worldObj; BlockPos blockpos = (new BlockPos(this.silverfish.posX, this.silverfish.posY + 0.5D, this.silverfish.posZ)).offset(this.facing); IBlockState iblockstate = world.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { world.setBlockState(blockpos, Blocks.MONSTER_EGG.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.forModelBlock(iblockstate)), 3); this.silverfish.spawnExplosionParticle(); this.silverfish.setDead(); } } }
public BiomeGenNileMountains(int p_i45373_1_, boolean p_i45373_2_) { super(p_i45373_1_); this.theWorldGenerator = new WorldGenMinable(Blocks.monster_egg.getDefaultState().withProperty(BlockSilverfish.VARIANT, BlockSilverfish.EnumType.STONE), 9); this.field_150634_aD = new WorldGenTaiga2(false); this.field_150635_aE = 0; this.field_150636_aF = 1; this.field_150637_aG = 2; this.field_150638_aH = this.field_150635_aE; if (p_i45373_2_) { this.theBiomeDecorator.treesPerChunk = 3; this.field_150638_aH = this.field_150636_aF; } }
@Override public void onHackFinished(World world, BlockPos pos, EntityPlayer player) { IBlockState state = world.getBlockState(pos); IBlockState newState; switch (state.getValue(BlockSilverfish.VARIANT)) { case COBBLESTONE: newState = Blocks.COBBLESTONE.getDefaultState(); break; case STONEBRICK: newState = Blocks.STONEBRICK.getDefaultState(); break; case MOSSY_STONEBRICK: newState = Blocks.STONEBRICK.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.MOSSY); break; case CRACKED_STONEBRICK: newState = Blocks.STONEBRICK.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.CRACKED); break; case CHISELED_STONEBRICK: newState = Blocks.STONEBRICK.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.CHISELED); break; default: newState = Blocks.STONE.getDefaultState(); break; } world.setBlockState(pos, newState); }
public void selectBlocks(Random rand, int x, int y, int z, boolean p_75062_5_) { if (p_75062_5_) { float f = rand.nextFloat(); if (f < 0.2F) { this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.CRACKED_META); } else if (f < 0.5F) { this.blockstate = Blocks.stonebrick.getStateFromMeta(BlockStoneBrick.MOSSY_META); } else if (f < 0.55F) { this.blockstate = Blocks.monster_egg.getStateFromMeta(BlockSilverfish.EnumType.STONEBRICK.getMetadata()); } else { this.blockstate = Blocks.stonebrick.getDefaultState(); } } else { this.blockstate = Blocks.air.getDefaultState(); } }
public boolean shouldExecute() { if (this.field_179485_a.getAttackTarget() != null) { return false; } else if (!this.field_179485_a.getNavigator().noPath()) { return false; } else { Random random = this.field_179485_a.getRNG(); if (random.nextInt(10) == 0) { this.facing = EnumFacing.random(random); BlockPos blockpos = (new BlockPos(this.field_179485_a.posX, this.field_179485_a.posY + 0.5D, this.field_179485_a.posZ)).offset(this.facing); IBlockState iblockstate = this.field_179485_a.worldObj.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { this.field_179484_c = true; return true; } } this.field_179484_c = false; return super.shouldExecute(); } }
public void updateTask() { --this.field_179463_b; if (this.field_179463_b <= 0) { World world = this.silverfish.worldObj; Random random = this.silverfish.getRNG(); BlockPos blockpos = new BlockPos(this.silverfish); for (int i = 0; i <= 5 && i >= -5; i = i <= 0 ? 1 - i : 0 - i) { for (int j = 0; j <= 10 && j >= -10; j = j <= 0 ? 1 - j : 0 - j) { for (int k = 0; k <= 10 && k >= -10; k = k <= 0 ? 1 - k : 0 - k) { BlockPos blockpos1 = blockpos.add(j, i, k); IBlockState iblockstate = world.getBlockState(blockpos1); if (iblockstate.getBlock() == Blocks.monster_egg) { if (world.getGameRules().getBoolean("mobGriefing")) { world.destroyBlock(blockpos1, true); } else { world.setBlockState(blockpos1, ((BlockSilverfish.EnumType)iblockstate.getValue(BlockSilverfish.VARIANT)).getModelBlock(), 3); } if (random.nextBoolean()) { return; } } } } } } }
public void selectBlocks(Random rand, int x, int y, int z, boolean p_75062_5_) { if (p_75062_5_) { float f = rand.nextFloat(); if (f < 0.2F) { this.blockstate = Blocks.STONEBRICK.getStateFromMeta(BlockStoneBrick.CRACKED_META); } else if (f < 0.5F) { this.blockstate = Blocks.STONEBRICK.getStateFromMeta(BlockStoneBrick.MOSSY_META); } else if (f < 0.55F) { this.blockstate = Blocks.MONSTER_EGG.getStateFromMeta(BlockSilverfish.EnumType.STONEBRICK.getMetadata()); } else { this.blockstate = Blocks.STONEBRICK.getDefaultState(); } } else { this.blockstate = Blocks.AIR.getDefaultState(); } }
public boolean shouldExecute() { if (this.entity.getAttackTarget() != null) { return false; } else if (!this.entity.getNavigator().noPath()) { return false; } else { Random random = this.entity.getRNG(); if (this.entity.world.getGameRules().getBoolean("mobGriefing") && random.nextInt(10) == 0) { this.facing = EnumFacing.random(random); BlockPos blockpos = (new BlockPos(this.entity.posX, this.entity.posY + 0.5D, this.entity.posZ)).offset(this.facing); IBlockState iblockstate = this.entity.world.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { this.doMerge = true; return true; } } this.doMerge = false; return super.shouldExecute(); } }
public void updateTask() { --this.lookForFriends; if (this.lookForFriends <= 0) { World world = this.silverfish.world; Random random = this.silverfish.getRNG(); BlockPos blockpos = new BlockPos(this.silverfish); for (int i = 0; i <= 5 && i >= -5; i = (i <= 0 ? 1 : 0) - i) { for (int j = 0; j <= 10 && j >= -10; j = (j <= 0 ? 1 : 0) - j) { for (int k = 0; k <= 10 && k >= -10; k = (k <= 0 ? 1 : 0) - k) { BlockPos blockpos1 = blockpos.add(j, i, k); IBlockState iblockstate = world.getBlockState(blockpos1); if (iblockstate.getBlock() == Blocks.MONSTER_EGG) { if (world.getGameRules().getBoolean("mobGriefing")) { world.destroyBlock(blockpos1, true); } else { world.setBlockState(blockpos1, ((BlockSilverfish.EnumType)iblockstate.getValue(BlockSilverfish.VARIANT)).getModelBlock(), 3); } if (random.nextBoolean()) { return; } } } } } } }
/** * picks Block Ids and Metadata (Silverfish) */ public void selectBlocks(Random rand, int x, int y, int z, boolean p_75062_5_) { if (p_75062_5_) { float f = rand.nextFloat(); if (f < 0.2F) { this.blockstate = Blocks.STONEBRICK.getStateFromMeta(BlockStoneBrick.CRACKED_META); } else if (f < 0.5F) { this.blockstate = Blocks.STONEBRICK.getStateFromMeta(BlockStoneBrick.MOSSY_META); } else if (f < 0.55F) { this.blockstate = Blocks.MONSTER_EGG.getStateFromMeta(BlockSilverfish.EnumType.STONEBRICK.getMetadata()); } else { this.blockstate = Blocks.STONEBRICK.getDefaultState(); } } else { this.blockstate = Blocks.AIR.getDefaultState(); } }
/** * Returns whether the EntityAIBase should begin execution. */ public boolean shouldExecute() { if (!this.silverfish.worldObj.getGameRules().getBoolean("mobGriefing")) { return false; } else if (this.silverfish.getAttackTarget() != null) { return false; } else if (!this.silverfish.getNavigator().noPath()) { return false; } else { Random random = this.silverfish.getRNG(); if (random.nextInt(10) == 0) { this.facing = EnumFacing.random(random); BlockPos blockpos = (new BlockPos(this.silverfish.posX, this.silverfish.posY + 0.5D, this.silverfish.posZ)).offset(this.facing); IBlockState iblockstate = this.silverfish.worldObj.getBlockState(blockpos); if (BlockSilverfish.canContainSilverfish(iblockstate)) { this.doMerge = true; return true; } } this.doMerge = false; return super.shouldExecute(); } }
/** * Updates the task */ public void updateTask() { --this.lookForFriends; if (this.lookForFriends <= 0) { World world = this.silverfish.worldObj; Random random = this.silverfish.getRNG(); BlockPos blockpos = new BlockPos(this.silverfish); for (int i = 0; i <= 5 && i >= -5; i = i <= 0 ? 1 - i : 0 - i) { for (int j = 0; j <= 10 && j >= -10; j = j <= 0 ? 1 - j : 0 - j) { for (int k = 0; k <= 10 && k >= -10; k = k <= 0 ? 1 - k : 0 - k) { BlockPos blockpos1 = blockpos.add(j, i, k); IBlockState iblockstate = world.getBlockState(blockpos1); if (iblockstate.getBlock() == Blocks.MONSTER_EGG) { if (world.getGameRules().getBoolean("mobGriefing")) { world.destroyBlock(blockpos1, true); } else { world.setBlockState(blockpos1, ((BlockSilverfish.EnumType)iblockstate.getValue(BlockSilverfish.VARIANT)).getModelBlock(), 3); } if (random.nextBoolean()) { return; } } } } } } }
protected void updateEntityActionState() { super.updateEntityActionState(); if (!this.worldObj.isClient) { int var1; int var2; int var3; int var6; if (this.allySummonCooldown > 0) { --this.allySummonCooldown; if (this.allySummonCooldown == 0) { var1 = MathHelper.floor_double(this.posX); var2 = MathHelper.floor_double(this.posY); var3 = MathHelper.floor_double(this.posZ); boolean var4 = false; for (int var5 = 0; !var4 && var5 <= 5 && var5 >= -5; var5 = var5 <= 0 ? 1 - var5 : 0 - var5) { for (var6 = 0; !var4 && var6 <= 10 && var6 >= -10; var6 = var6 <= 0 ? 1 - var6 : 0 - var6) { for (int var7 = 0; !var4 && var7 <= 10 && var7 >= -10; var7 = var7 <= 0 ? 1 - var7 : 0 - var7) { if (this.worldObj.getBlock(var1 + var6, var2 + var5, var3 + var7) == Blocks.monster_egg) { if (!this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { int var8 = this.worldObj.getBlockMetadata(var1 + var6, var2 + var5, var3 + var7); ImmutablePair var9 = BlockSilverfish.func_150197_b(var8); this.worldObj.setBlock(var1 + var6, var2 + var5, var3 + var7, (Block)var9.getLeft(), ((Integer)var9.getRight()).intValue(), 3); } else { this.worldObj.func_147480_a(var1 + var6, var2 + var5, var3 + var7, false); } Blocks.monster_egg.onBlockDestroyedByPlayer(this.worldObj, var1 + var6, var2 + var5, var3 + var7, 0); if (this.rand.nextBoolean()) { var4 = true; break; } } } } } } } if (this.entityToAttack == null && !this.hasPath()) { var1 = MathHelper.floor_double(this.posX); var2 = MathHelper.floor_double(this.posY + 0.5D); var3 = MathHelper.floor_double(this.posZ); int var10 = this.rand.nextInt(6); Block var11 = this.worldObj.getBlock(var1 + Facing.offsetsXForSide[var10], var2 + Facing.offsetsYForSide[var10], var3 + Facing.offsetsZForSide[var10]); var6 = this.worldObj.getBlockMetadata(var1 + Facing.offsetsXForSide[var10], var2 + Facing.offsetsYForSide[var10], var3 + Facing.offsetsZForSide[var10]); if (BlockSilverfish.func_150196_a(var11)) { this.worldObj.setBlock(var1 + Facing.offsetsXForSide[var10], var2 + Facing.offsetsYForSide[var10], var3 + Facing.offsetsZForSide[var10], Blocks.monster_egg, BlockSilverfish.func_150195_a(var11, var6), 3); this.spawnExplosionParticle(); this.setDead(); } else { this.updateWanderPath(); } } else if (this.entityToAttack != null && !this.hasPath()) { this.entityToAttack = null; } } }
protected void updateEntityActionState() { super.updateEntityActionState(); if (!this.worldObj.isRemote) { int i; int j; int k; int i1; if (this.allySummonCooldown > 0) { --this.allySummonCooldown; if (this.allySummonCooldown == 0) { i = MathHelper.floor_double(this.posX); j = MathHelper.floor_double(this.posY); k = MathHelper.floor_double(this.posZ); boolean flag = false; for (int l = 0; !flag && l <= 5 && l >= -5; l = l <= 0 ? 1 - l : 0 - l) { for (i1 = 0; !flag && i1 <= 10 && i1 >= -10; i1 = i1 <= 0 ? 1 - i1 : 0 - i1) { for (int j1 = 0; !flag && j1 <= 10 && j1 >= -10; j1 = j1 <= 0 ? 1 - j1 : 0 - j1) { if (this.worldObj.getBlock(i + i1, j + l, k + j1) == Blocks.monster_egg) { if (!this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) { int k1 = this.worldObj.getBlockMetadata(i + i1, j + l, k + j1); ImmutablePair immutablepair = BlockSilverfish.func_150197_b(k1); this.worldObj.setBlock(i + i1, j + l, k + j1, (Block)immutablepair.getLeft(), ((Integer)immutablepair.getRight()).intValue(), 3); } else { this.worldObj.func_147480_a(i + i1, j + l, k + j1, false); } Blocks.monster_egg.onBlockDestroyedByPlayer(this.worldObj, i + i1, j + l, k + j1, 0); if (this.rand.nextBoolean()) { flag = true; break; } } } } } } } if (this.entityToAttack == null && !this.hasPath()) { i = MathHelper.floor_double(this.posX); j = MathHelper.floor_double(this.posY + 0.5D); k = MathHelper.floor_double(this.posZ); int l1 = this.rand.nextInt(6); Block block = this.worldObj.getBlock(i + Facing.offsetsXForSide[l1], j + Facing.offsetsYForSide[l1], k + Facing.offsetsZForSide[l1]); i1 = this.worldObj.getBlockMetadata(i + Facing.offsetsXForSide[l1], j + Facing.offsetsYForSide[l1], k + Facing.offsetsZForSide[l1]); if (BlockSilverfish.func_150196_a(block)) { this.worldObj.setBlock(i + Facing.offsetsXForSide[l1], j + Facing.offsetsYForSide[l1], k + Facing.offsetsZForSide[l1], Blocks.monster_egg, BlockSilverfish.func_150195_a(block, i1), 3); this.spawnExplosionParticle(); this.setDead(); } else { this.updateWanderPath(); } } else if (this.entityToAttack != null && !this.hasPath()) { this.entityToAttack = null; } } }
protected void func_70626_be() { super.func_70626_be(); if(!this.field_70170_p.field_72995_K) { int var1; int var2; int var3; int var5; if(this.field_70843_d > 0) { --this.field_70843_d; if(this.field_70843_d == 0) { var1 = MathHelper.func_76128_c(this.field_70165_t); var2 = MathHelper.func_76128_c(this.field_70163_u); var3 = MathHelper.func_76128_c(this.field_70161_v); boolean var4 = false; for(var5 = 0; !var4 && var5 <= 5 && var5 >= -5; var5 = var5 <= 0?1 - var5:0 - var5) { for(int var6 = 0; !var4 && var6 <= 10 && var6 >= -10; var6 = var6 <= 0?1 - var6:0 - var6) { for(int var7 = 0; !var4 && var7 <= 10 && var7 >= -10; var7 = var7 <= 0?1 - var7:0 - var7) { int var8 = this.field_70170_p.func_72798_a(var1 + var6, var2 + var5, var3 + var7); if(var8 == Block.field_72006_bl.field_71990_ca) { if(!this.field_70170_p.func_82736_K().func_82766_b("mobGriefing")) { int var9 = this.field_70170_p.func_72805_g(var1 + var6, var2 + var5, var3 + var7); Block var10 = Block.field_71981_t; if(var9 == 1) { var10 = Block.field_71978_w; } if(var9 == 2) { var10 = Block.field_72007_bm; } this.field_70170_p.func_72832_d(var1 + var6, var2 + var5, var3 + var7, var10.field_71990_ca, 0, 3); } else { this.field_70170_p.func_94578_a(var1 + var6, var2 + var5, var3 + var7, false); } Block.field_72006_bl.func_71898_d(this.field_70170_p, var1 + var6, var2 + var5, var3 + var7, 0); if(this.field_70146_Z.nextBoolean()) { var4 = true; break; } } } } } } } if(this.field_70789_a == null && !this.func_70781_l()) { var1 = MathHelper.func_76128_c(this.field_70165_t); var2 = MathHelper.func_76128_c(this.field_70163_u + 0.5D); var3 = MathHelper.func_76128_c(this.field_70161_v); int var11 = this.field_70146_Z.nextInt(6); var5 = this.field_70170_p.func_72798_a(var1 + Facing.field_71586_b[var11], var2 + Facing.field_71587_c[var11], var3 + Facing.field_71585_d[var11]); if(BlockSilverfish.func_72154_e(var5)) { this.field_70170_p.func_72832_d(var1 + Facing.field_71586_b[var11], var2 + Facing.field_71587_c[var11], var3 + Facing.field_71585_d[var11], Block.field_72006_bl.field_71990_ca, BlockSilverfish.func_72153_f(var5), 3); this.func_70656_aK(); this.func_70106_y(); } else { this.func_70779_j(); } } else if(this.field_70789_a != null && !this.func_70781_l()) { this.field_70789_a = null; } } }