public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { if (Func_322_g(world, i, j, k)) { int i1 = world.GetBlockMetadata(i, j, k) & 7; bool flag = false; if (!world.IsBlockNormalCube(i - 1, j, k) && i1 == 1) { flag = true; } if (!world.IsBlockNormalCube(i + 1, j, k) && i1 == 2) { flag = true; } if (!world.IsBlockNormalCube(i, j, k - 1) && i1 == 3) { flag = true; } if (!world.IsBlockNormalCube(i, j, k + 1) && i1 == 4) { flag = true; } if (flag) { DropBlockAsItem(world, i, j, k, world.GetBlockMetadata(i, j, k)); world.SetBlockWithNotify(i, j, k, 0); } } }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); bool flag = false; if (i1 == 2 && world.IsBlockNormalCube(i, j, k + 1)) { flag = true; } if (i1 == 3 && world.IsBlockNormalCube(i, j, k - 1)) { flag = true; } if (i1 == 4 && world.IsBlockNormalCube(i + 1, j, k)) { flag = true; } if (i1 == 5 && world.IsBlockNormalCube(i - 1, j, k)) { flag = true; } if (!flag) { DropBlockAsItem(world, i, j, k, i1); world.SetBlockWithNotify(i, j, k, 0); } base.OnNeighborBlockChange(world, i, j, k, l); }
public override void OnBlockPlaced(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); if (l == 1 && Func_31028_g(world, i, j - 1, k)) { i1 = 5; } if (l == 2 && world.IsBlockNormalCube(i, j, k + 1)) { i1 = 4; } if (l == 3 && world.IsBlockNormalCube(i, j, k - 1)) { i1 = 3; } if (l == 4 && world.IsBlockNormalCube(i + 1, j, k)) { i1 = 2; } if (l == 5 && world.IsBlockNormalCube(i - 1, j, k)) { i1 = 1; } world.SetBlockMetadataWithNotify(i, j, k, i1); }
private static bool Func_21167_a(net.minecraft.src.EnumCreatureType enumcreaturetype , net.minecraft.src.World world, int i, int j, int k) { if (enumcreaturetype.GetCreatureMaterial() == net.minecraft.src.Material.water) { return(world.GetBlockMaterial(i, j, k).GetIsLiquid() && !world.IsBlockNormalCube( i, j + 1, k)); } else { return(world.IsBlockNormalCube(i, j - 1, k) && !world.IsBlockNormalCube(i, j, k) && !world.GetBlockMaterial(i, j, k).GetIsLiquid() && !world.IsBlockNormalCube(i, j + 1, k)); } }
public override void OnBlockRemoval(net.minecraft.src.World world, int i, int j, int k) { base.OnBlockRemoval(world, i, j, k); if (world.singleplayerWorld) { return; } world.NotifyBlocksOfNeighborChange(i, j + 1, k, ID); world.NotifyBlocksOfNeighborChange(i, j - 1, k, ID); UpdateAndPropagateCurrentStrength(world, i, j, k); NotifyWireNeighborsOfNeighborChange(world, i - 1, j, k); NotifyWireNeighborsOfNeighborChange(world, i + 1, j, k); NotifyWireNeighborsOfNeighborChange(world, i, j, k - 1); NotifyWireNeighborsOfNeighborChange(world, i, j, k + 1); if (world.IsBlockNormalCube(i - 1, j, k)) { NotifyWireNeighborsOfNeighborChange(world, i - 1, j + 1, k); } else { NotifyWireNeighborsOfNeighborChange(world, i - 1, j - 1, k); } if (world.IsBlockNormalCube(i + 1, j, k)) { NotifyWireNeighborsOfNeighborChange(world, i + 1, j + 1, k); } else { NotifyWireNeighborsOfNeighborChange(world, i + 1, j - 1, k); } if (world.IsBlockNormalCube(i, j, k - 1)) { NotifyWireNeighborsOfNeighborChange(world, i, j + 1, k - 1); } else { NotifyWireNeighborsOfNeighborChange(world, i, j - 1, k - 1); } if (world.IsBlockNormalCube(i, j, k + 1)) { NotifyWireNeighborsOfNeighborChange(world, i, j + 1, k + 1); } else { NotifyWireNeighborsOfNeighborChange(world, i, j - 1, k + 1); } }
public static net.minecraft.src.ChunkCoordinates Func_22021_g(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); int j1 = Func_22019_c(i1); for (int k1 = 0; k1 <= 1; k1++) { int l1 = i - field_22023_a[j1][0] * k1 - 1; int i2 = k - field_22023_a[j1][1] * k1 - 1; int j2 = l1 + 2; int k2 = i2 + 2; for (int l2 = l1; l2 <= j2; l2++) { for (int i3 = i2; i3 <= k2; i3++) { if (!world.IsBlockNormalCube(l2, j - 1, i3) || !world.IsAirBlock(l2, j, i3) || !world .IsAirBlock(l2, j + 1, i3)) { continue; } if (l > 0) { l--; } else { return(new net.minecraft.src.ChunkCoordinates(l2, j, i3)); } } } } return(null); }
private int GetOrientation(net.minecraft.src.World world, int i, int j, int k) { if (world.IsBlockNormalCube(i - 1, j, k)) { return(1); } if (world.IsBlockNormalCube(i + 1, j, k)) { return(2); } if (world.IsBlockNormalCube(i, j, k - 1)) { return(3); } return(!world.IsBlockNormalCube(i, j, k + 1) ? 1 : 4); }
public override bool CanPlaceBlockOnSide(net.minecraft.src.World world, int i, int j, int k, int l) { if (l == 0) { return(false); } if (l == 1) { return(false); } if (l == 2) { k++; } if (l == 3) { k--; } if (l == 4) { i++; } if (l == 5) { i--; } return(world.IsBlockNormalCube(i, j, k)); }
public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j, int k) { if (world.IsBlockNormalCube(i - 1, j, k)) { return(true); } if (world.IsBlockNormalCube(i + 1, j, k)) { return(true); } if (world.IsBlockNormalCube(i, j, k - 1)) { return(true); } return(world.IsBlockNormalCube(i, j, k + 1)); }
public override bool CanPlaceBlockOnSide(net.minecraft.src.World world, int i, int j, int k, int l) { if (l == 2 && world.IsBlockNormalCube(i, j, k + 1)) { return(true); } if (l == 3 && world.IsBlockNormalCube(i, j, k - 1)) { return(true); } if (l == 4 && world.IsBlockNormalCube(i + 1, j, k)) { return(true); } return(l == 5 && world.IsBlockNormalCube(i - 1, j, k)); }
public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j, int k) { int l = world.GetBlockId(i, j, k); return((l == 0 || net.minecraft.src.Block.blocksList[l].blockMaterial.Func_27090_g ()) && world.IsBlockNormalCube(i, j - 1, k)); }
public override bool CanBlockStay(net.minecraft.src.World world, int i, int j, int k) { if (!world.IsBlockNormalCube(i, j - 1, k)) { return(false); } else { return(base.CanBlockStay(world, i, j, k)); } }
public override void OnBlockPlaced(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); int j1 = i1 & 8; i1 &= 7; i1 = -1; if (l == 1 && world.IsBlockNormalCube(i, j - 1, k)) { i1 = 5 + world.rand.Next(2); } if (l == 2 && world.IsBlockNormalCube(i, j, k + 1)) { i1 = 4; } if (l == 3 && world.IsBlockNormalCube(i, j, k - 1)) { i1 = 3; } if (l == 4 && world.IsBlockNormalCube(i + 1, j, k)) { i1 = 2; } if (l == 5 && world.IsBlockNormalCube(i - 1, j, k)) { i1 = 1; } if (i1 == -1) { DropBlockAsItem(world, i, j, k, world.GetBlockMetadata(i, j, k)); world.SetBlockWithNotify(i, j, k, 0); return; } else { world.SetBlockMetadataWithNotify(i, j, k, i1 + j1); return; } }
public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j, int k) { if (j >= 127) { return(false); } else { return(world.IsBlockNormalCube(i, j - 1, k) && base.CanPlaceBlockAt(world, i, j, k) && base.CanPlaceBlockAt(world, i, j + 1, k)); } }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { if (!world.IsBlockNormalCube(i, j - 1, k) && !Func_268_g(world, i, j, k)) { world.SetBlockWithNotify(i, j, k, 0); return; } else { return; } }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); if ((i1 & 8) != 0) { if (world.GetBlockId(i, j - 1, k) != ID) { world.SetBlockWithNotify(i, j, k, 0); } if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower()) { OnNeighborBlockChange(world, i, j - 1, k, l); } } else { bool flag = false; if (world.GetBlockId(i, j + 1, k) != ID) { world.SetBlockWithNotify(i, j, k, 0); flag = true; } if (!world.IsBlockNormalCube(i, j - 1, k)) { world.SetBlockWithNotify(i, j, k, 0); flag = true; if (world.GetBlockId(i, j + 1, k) == ID) { world.SetBlockWithNotify(i, j + 1, k, 0); } } if (flag) { if (!world.singleplayerWorld) { DropBlockAsItem(world, i, j, k, i1); } } else { if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower()) { bool flag1 = world.IsBlockIndirectlyGettingPowered(i, j, k) || world.IsBlockIndirectlyGettingPowered (i, j + 1, k); Func_272_a(world, i, j, k, flag1); } } } }
public override void OnBlockPlaced(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); int j1 = i1 & 8; i1 &= 7; if (l == 2 && world.IsBlockNormalCube(i, j, k + 1)) { i1 = 4; } else { if (l == 3 && world.IsBlockNormalCube(i, j, k - 1)) { i1 = 3; } else { if (l == 4 && world.IsBlockNormalCube(i + 1, j, k)) { i1 = 2; } else { if (l == 5 && world.IsBlockNormalCube(i - 1, j, k)) { i1 = 1; } else { i1 = GetOrientation(world, i, j, k); } } } } world.SetBlockMetadataWithNotify(i, j, k, i1 + j1); }
public override void OnBlockPlaced(net.minecraft.src.World world, int i, int j, int k, int l) { int i1 = world.GetBlockMetadata(i, j, k); if ((i1 == 0 || l == 2) && world.IsBlockNormalCube(i, j, k + 1)) { i1 = 2; } if ((i1 == 0 || l == 3) && world.IsBlockNormalCube(i, j, k - 1)) { i1 = 3; } if ((i1 == 0 || l == 4) && world.IsBlockNormalCube(i + 1, j, k)) { i1 = 4; } if ((i1 == 0 || l == 5) && world.IsBlockNormalCube(i - 1, j, k)) { i1 = 5; } world.SetBlockMetadataWithNotify(i, j, k, i1); }
public override void OnBlockAdded(net.minecraft.src.World world, int i, int j, int k) { if (world.IsBlockNormalCube(i - 1, j, k)) { world.SetBlockMetadataWithNotify(i, j, k, 1); } else { if (world.IsBlockNormalCube(i + 1, j, k)) { world.SetBlockMetadataWithNotify(i, j, k, 2); } else { if (world.IsBlockNormalCube(i, j, k - 1)) { world.SetBlockMetadataWithNotify(i, j, k, 3); } else { if (world.IsBlockNormalCube(i, j, k + 1)) { world.SetBlockMetadataWithNotify(i, j, k, 4); } else { if (Func_31028_g(world, i, j - 1, k)) { world.SetBlockMetadataWithNotify(i, j, k, 5); } } } } } DropTorchIfCantStay(world, i, j, k); }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { bool flag = false; if (!world.IsBlockNormalCube(i, j - 1, k)) { flag = true; } if (flag) { DropBlockAsItem(world, i, j, k, world.GetBlockMetadata(i, j, k)); world.SetBlockWithNotify(i, j, k, 0); } }
// Referenced classes of package net.minecraft.src: // Item, Block, BlockBed, EntityPlayer, // MathHelper, World, ItemStack public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer entityplayer, net.minecraft.src.World world, int i, int j, int k, int l) { if (l != 1) { return(false); } j++; net.minecraft.src.BlockBed blockbed = (net.minecraft.src.BlockBed)net.minecraft.src.Block .BED; int i1 = net.minecraft.src.MathHelper.Floor_double((double)((entityplayer.rotationYaw * 4F) / 360F) + 0.5D) & 3; byte byte0 = 0; byte byte1 = 0; if (i1 == 0) { byte1 = 1; } if (i1 == 1) { byte0 = unchecked ((byte)(-1)); } if (i1 == 2) { byte1 = unchecked ((byte)(-1)); } if (i1 == 3) { byte0 = 1; } if (world.IsAirBlock(i, j, k) && world.IsAirBlock(i + byte0, j, k + byte1) && world .IsBlockNormalCube(i, j - 1, k) && world.IsBlockNormalCube(i + byte0, j - 1, k + byte1)) { world.SetBlockAndMetadataWithNotify(i, j, k, blockbed.ID, i1); world.SetBlockAndMetadataWithNotify(i + byte0, j, k + byte1, blockbed.ID, i1 + 8); itemstack.stackSize--; return(true); } else { return(false); } }
public override void OnBlockAdded(net.minecraft.src.World world, int i, int j, int k) { if (world.GetBlockId(i, j - 1, k) == net.minecraft.src.Block.OBSIDIAN.ID && net.minecraft.src.Block.PORTAL.TryToCreatePortal(world, i, j, k)) { return; } if (!world.IsBlockNormalCube(i, j - 1, k) && !Func_268_g(world, i, j, k)) { world.SetBlockWithNotify(i, j, k, 0); return; } else { world.ScheduleUpdateTick(i, j, k, ID, TickRate()); return; } }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { if (world.singleplayerWorld) { return; } int i1 = world.GetBlockMetadata(i, j, k); int j1 = i; int k1 = k; if ((i1 & 3) == 0) { k1++; } if ((i1 & 3) == 1) { k1--; } if ((i1 & 3) == 2) { j1++; } if ((i1 & 3) == 3) { j1--; } if (!world.IsBlockNormalCube(j1, j, k1)) { world.SetBlockWithNotify(i, j, k, 0); DropBlockAsItem(world, i, j, k, i1); } if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower()) { bool flag = world.IsBlockIndirectlyGettingPowered(i, j, k); Func_28040_a(world, i, j, k, flag); } }
private void Func_21031_a(net.minecraft.src.World world, int i, int j, int k, int l, int i1, int j1) { int k1 = world.GetBlockMetadata(i, j, k); int l1 = 0; wiresProvidePower = false; bool flag = world.IsBlockIndirectlyGettingPowered(i, j, k); wiresProvidePower = true; if (flag) { l1 = 15; } else { for (int i2 = 0; i2 < 4; i2++) { int k2 = i; int i3 = k; if (i2 == 0) { k2--; } if (i2 == 1) { k2++; } if (i2 == 2) { i3--; } if (i2 == 3) { i3++; } if (k2 != l || j != i1 || i3 != j1) { l1 = GetMaxCurrentStrength(world, k2, j, i3, l1); } if (world.IsBlockNormalCube(k2, j, i3) && !world.IsBlockNormalCube(i, j + 1, k)) { if (k2 != l || j + 1 != i1 || i3 != j1) { l1 = GetMaxCurrentStrength(world, k2, j + 1, i3, l1); } continue; } if (!world.IsBlockNormalCube(k2, j, i3) && (k2 != l || j - 1 != i1 || i3 != j1)) { l1 = GetMaxCurrentStrength(world, k2, j - 1, i3, l1); } } if (l1 > 0) { l1--; } else { l1 = 0; } } if (k1 != l1) { world.editingBlocks = true; world.SetBlockMetadataWithNotify(i, j, k, l1); world.MarkBlocksDirty(i, j, k, i, j, k); world.editingBlocks = false; for (int j2 = 0; j2 < 4; j2++) { int l2 = i; int j3 = k; int k3 = j - 1; if (j2 == 0) { l2--; } if (j2 == 1) { l2++; } if (j2 == 2) { j3--; } if (j2 == 3) { j3++; } if (world.IsBlockNormalCube(l2, j, j3)) { k3 += 2; } int l3 = 0; l3 = GetMaxCurrentStrength(world, l2, j, j3, -1); l1 = world.GetBlockMetadata(i, j, k); if (l1 > 0) { l1--; } if (l3 >= 0 && l3 != l1) { Func_21031_a(world, l2, j, j3, i, j, k); } l3 = GetMaxCurrentStrength(world, l2, k3, j3, -1); l1 = world.GetBlockMetadata(i, j, k); if (l1 > 0) { l1--; } if (l3 >= 0 && l3 != l1) { Func_21031_a(world, l2, k3, j3, i, j, k); } } if (k1 == 0 || l1 == 0) { field_21032_b.Add(new net.minecraft.src.ChunkPosition(i, j, k)); field_21032_b.Add(new net.minecraft.src.ChunkPosition(i - 1, j, k)); field_21032_b.Add(new net.minecraft.src.ChunkPosition(i + 1, j, k)); field_21032_b.Add(new net.minecraft.src.ChunkPosition(i, j - 1, k)); field_21032_b.Add(new net.minecraft.src.ChunkPosition(i, j + 1, k)); field_21032_b.Add(new net.minecraft.src.ChunkPosition(i, j, k - 1)); field_21032_b.Add(new net.minecraft.src.ChunkPosition(i, j, k + 1)); } } }
public override void UpdateTick(net.minecraft.src.World world, int i, int j, int k, SharpBukkitLive.SharpBukkit.SharpRandom random) { bool flag = world.GetBlockId(i, j - 1, k) == net.minecraft.src.Block.NETHERRACK.ID; if (!CanPlaceBlockAt(world, i, j, k)) { world.SetBlockWithNotify(i, j, k, 0); } if (!flag && world.Func_27068_v() && (world.CanLightningStrikeAt(i, j, k) || world .CanLightningStrikeAt(i - 1, j, k) || world.CanLightningStrikeAt(i + 1, j, k) || world.CanLightningStrikeAt(i, j, k - 1) || world.CanLightningStrikeAt(i, j, k + 1))) { world.SetBlockWithNotify(i, j, k, 0); return; } int l = world.GetBlockMetadata(i, j, k); if (l < 15) { world.SetBlockMetadata(i, j, k, l + random.Next(3) / 2); } world.ScheduleUpdateTick(i, j, k, ID, TickRate()); if (!flag && !Func_268_g(world, i, j, k)) { if (!world.IsBlockNormalCube(i, j - 1, k) || l > 3) { world.SetBlockWithNotify(i, j, k, 0); } return; } if (!flag && !CanBlockCatchFire(world, i, j - 1, k) && l == 15 && random.Next( 4) == 0) { world.SetBlockWithNotify(i, j, k, 0); return; } TryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l); TryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l); TryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l); TryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l); TryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l); TryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l); for (int i1 = i - 1; i1 <= i + 1; i1++) { for (int j1 = k - 1; j1 <= k + 1; j1++) { for (int k1 = j - 1; k1 <= j + 4; k1++) { if (i1 == i && k1 == j && j1 == k) { continue; } int l1 = 100; if (k1 > j + 1) { l1 += (k1 - (j + 1)) * 100; } int i2 = GetChanceOfNeighborsEncouragingFire(world, i1, k1, j1); if (i2 <= 0) { continue; } int j2 = (i2 + 40) / (l + 30); if (j2 <= 0 || random.Next(l1) > j2 || world.Func_27068_v() && world.CanLightningStrikeAt (i1, k1, j1) || world.CanLightningStrikeAt(i1 - 1, k1, k) || world.CanLightningStrikeAt (i1 + 1, k1, j1) || world.CanLightningStrikeAt(i1, k1, j1 - 1) || world.CanLightningStrikeAt (i1, k1, j1 + 1)) { continue; } int k2 = l + random.Next(5) / 4; if (k2 > 15) { k2 = 15; } world.SetBlockAndMetadataWithNotify(i1, k1, j1, ID, k2); } } } }
public override bool OnItemUse(net.minecraft.src.ItemStack itemstack, net.minecraft.src.EntityPlayer entityplayer, net.minecraft.src.World world, int i, int j, int k, int l) { if (l != 1) { return(false); } j++; net.minecraft.src.Block block; if (field_260_a == net.minecraft.src.Material.wood) { block = net.minecraft.src.Block.WOODEN_DOOR; } else { block = net.minecraft.src.Block.IRON_DOOR_BLOCK; } if (!block.CanPlaceBlockAt(world, i, j, k)) { return(false); } int i1 = net.minecraft.src.MathHelper.Floor_double((double)(((entityplayer.rotationYaw + 180F) * 4F) / 360F) - 0.5D) & 3; byte byte0 = 0; byte byte1 = 0; if (i1 == 0) { byte1 = 1; } if (i1 == 1) { byte0 = unchecked ((byte)(-1)); } if (i1 == 2) { byte1 = unchecked ((byte)(-1)); } if (i1 == 3) { byte0 = 1; } int j1 = (world.IsBlockNormalCube(i - byte0, j, k - byte1) ? 1 : 0) + (world.IsBlockNormalCube (i - byte0, j + 1, k - byte1) ? 1 : 0); int k1 = (world.IsBlockNormalCube(i + byte0, j, k + byte1) ? 1 : 0) + (world.IsBlockNormalCube (i + byte0, j + 1, k + byte1) ? 1 : 0); bool flag = world.GetBlockId(i - byte0, j, k - byte1) == block.ID || world.GetBlockId (i - byte0, j + 1, k - byte1) == block.ID; bool flag1 = world.GetBlockId(i + byte0, j, k + byte1) == block.ID || world. GetBlockId(i + byte0, j + 1, k + byte1) == block.ID; bool flag2 = false; if (flag && !flag1) { flag2 = true; } else { if (k1 > j1) { flag2 = true; } } if (flag2) { i1 = i1 - 1 & 3; i1 += 4; } world.editingBlocks = true; world.SetBlockAndMetadataWithNotify(i, j, k, block.ID, i1); world.SetBlockAndMetadataWithNotify(i, j + 1, k, block.ID, i1 + 8); world.editingBlocks = false; world.NotifyBlocksOfNeighborChange(i, j, k, block.ID); world.NotifyBlocksOfNeighborChange(i, j + 1, k, block.ID); itemstack.stackSize--; return(true); }
public static int PerformSpawning(net.minecraft.src.World var0, bool var1, bool var2 ) { if (!var1 && !var2) { return(0); } else { eligibleChunksForSpawning.Clear(); int var3; int var6; for (var3 = 0; var3 < var0.playerEntities.Count; ++var3) { net.minecraft.src.EntityPlayer var4 = (net.minecraft.src.EntityPlayer)var0.playerEntities [var3]; int var5 = net.minecraft.src.MathHelper.Floor_double(var4.posX / 16.0D); var6 = net.minecraft.src.MathHelper.Floor_double(var4.posZ / 16.0D); byte var7 = 8; for (int var8 = -var7; var8 <= var7; ++var8) { for (int var9 = -var7; var9 <= var7; ++var9) { eligibleChunksForSpawning.Add(new net.minecraft.src.ChunkCoordIntPair(var8 + var5, var9 + var6)); } } } var3 = 0; net.minecraft.src.ChunkCoordinates var35 = var0.GetSpawnPoint(); net.minecraft.src.EnumCreatureType[] var36 = net.minecraft.src.EnumCreatureType.Values(); var6 = var36.Length; for (int var37 = 0; var37 < var6; ++var37) { net.minecraft.src.EnumCreatureType var38 = var36[var37]; if ((!var38.Func_21103_d() || var2) && (var38.Func_21103_d() || var1) && var0.CountEntities (var38.GetCreatureClass()) <= var38.GetMaxNumberOfCreature() * eligibleChunksForSpawning .Count / 256) { System.Collections.IEnumerator var39 = eligibleChunksForSpawning.GetEnumerator(); while (var39.MoveNext()) { net.minecraft.src.ChunkCoordIntPair var10 = (net.minecraft.src.ChunkCoordIntPair) var39.Current; net.minecraft.src.BiomeGenBase var11 = var0.GetWorldChunkManager().Func_4066_a(var10 ); System.Collections.IList var12 = var11.GetSpawnableList(var38); if (var12 != null && var12.Count > 0) { int var13 = 0; net.minecraft.src.SpawnListEntry var15; for (System.Collections.IEnumerator var14 = var12.GetEnumerator(); var14.MoveNext (); var13 += var15.spawnRarityRate) { var15 = (net.minecraft.src.SpawnListEntry)var14.Current; } int var40 = var0.rand.Next(var13); var15 = (net.minecraft.src.SpawnListEntry)var12[0]; System.Collections.IEnumerator var16 = var12.GetEnumerator(); while (var16.MoveNext()) { net.minecraft.src.SpawnListEntry var17 = (net.minecraft.src.SpawnListEntry)var16. Current; var40 -= var17.spawnRarityRate; if (var40 < 0) { var15 = var17; break; } } net.minecraft.src.ChunkPosition var41 = GetRandomSpawningPointInChunk(var0, var10 .X * 16, var10.Z * 16); int var42 = var41.x; int var18 = var41.y; int var19 = var41.z; if (!var0.IsBlockNormalCube(var42, var18, var19) && var0.GetBlockMaterial(var42, var18, var19) == var38.GetCreatureMaterial()) { int var20 = 0; for (int var21 = 0; var21 < 3; ++var21) { int var22 = var42; int var23 = var18; int var24 = var19; byte var25 = 6; for (int var26 = 0; var26 < 4; ++var26) { var22 += var0.rand.Next(var25) - var0.rand.Next(var25); var23 += var0.rand.Next(1) - var0.rand.Next(1); var24 += var0.rand.Next(var25) - var0.rand.Next(var25); if (Func_21167_a(var38, var0, var22, var23, var24)) { float var27 = (float)var22 + 0.5F; float var28 = (float)var23; float var29 = (float)var24 + 0.5F; if (var0.GetClosestPlayer((double)var27, (double)var28, (double)var29, 24.0D) == null) { float var30 = var27 - (float)var35.posX; float var31 = var28 - (float)var35.posY; float var32 = var29 - (float)var35.posZ; float var33 = var30 * var30 + var31 * var31 + var32 * var32; if (var33 >= 576.0F) { net.minecraft.src.EntityLiving var43; try { var43 = (net.minecraft.src.EntityLiving)(var15.entityClass.GetConstructor(new System.Type[] { typeof(net.minecraft.src.World) }).Invoke(new object[] { var0 })); } catch (System.Exception var34) { Sharpen.Runtime.PrintStackTrace(var34); return(var3); } var43.SetLocationAndAngles((double)var27, (double)var28, (double)var29, var0.rand .NextFloat() * 360.0F, 0.0F); if (var43.GetCanSpawnHere()) { ++var20; var0.AddEntity(var43); Func_21166_a(var43, var0, var27, var28, var29); if (var20 >= var43.GetMaxSpawnedInChunk()) { goto label113_continue; } } var3 += var20; } } } } } } } label113_continue :; } label113_break :; } } return(var3); } }
public override bool CanPlaceBlockAt(net.minecraft.src.World world, int i, int j, int k) { return(world.IsBlockNormalCube(i, j - 1, k)); }
public override void OnNeighborBlockChange(net.minecraft.src.World world, int i, int j, int k, int l) { if (world.singleplayerWorld) { return; } int i1 = world.GetBlockMetadata(i, j, k); int j1 = i1; if (field_27034_a) { j1 &= 7; } bool flag = false; if (!world.IsBlockNormalCube(i, j - 1, k)) { flag = true; } if (j1 == 2 && !world.IsBlockNormalCube(i + 1, j, k)) { flag = true; } if (j1 == 3 && !world.IsBlockNormalCube(i - 1, j, k)) { flag = true; } if (j1 == 4 && !world.IsBlockNormalCube(i, j, k - 1)) { flag = true; } if (j1 == 5 && !world.IsBlockNormalCube(i, j, k + 1)) { flag = true; } if (flag) { DropBlockAsItem(world, i, j, k, world.GetBlockMetadata(i, j, k)); world.SetBlockWithNotify(i, j, k, 0); } else { if (ID == net.minecraft.src.Block.GOLDEN_RAIL.ID) { bool flag1 = world.IsBlockIndirectlyGettingPowered(i, j, k) || world.IsBlockIndirectlyGettingPowered (i, j + 1, k); flag1 = flag1 || Func_27032_a(world, i, j, k, i1, true, 0) || Func_27032_a(world, i, j, k, i1, false, 0); bool flag2 = false; if (flag1 && (i1 & 8) == 0) { world.SetBlockMetadataWithNotify(i, j, k, j1 | 8); flag2 = true; } else { if (!flag1 && (i1 & 8) != 0) { world.SetBlockMetadataWithNotify(i, j, k, j1); flag2 = true; } } if (flag2) { world.NotifyBlocksOfNeighborChange(i, j - 1, k, ID); if (j1 == 2 || j1 == 3 || j1 == 4 || j1 == 5) { world.NotifyBlocksOfNeighborChange(i, j + 1, k, ID); } } } else { if (l > 0 && net.minecraft.src.Block.blocksList[l].CanProvidePower() && !field_27034_a && net.minecraft.src.RailLogic.GetNAdjacentTracks(new net.minecraft.src.RailLogic (this, world, i, j, k)) == 3) { Func_4038_g(world, i, j, k, false); } } } }
public static bool PerformSleepSpawning(net.minecraft.src.World world, List <EntityPlayer> list) { bool flag = false; net.minecraft.src.Pathfinder pathfinder = new net.minecraft.src.Pathfinder(world); System.Collections.IEnumerator iterator = list.GetEnumerator(); do { if (!iterator.MoveNext()) { break; } net.minecraft.src.EntityPlayer entityplayer = (net.minecraft.src.EntityPlayer)iterator .Current; System.Type[] aclass = field_22213_a; if (aclass != null && aclass.Length != 0) { bool flag1 = false; int i = 0; while (i < 20 && !flag1) { int j = (net.minecraft.src.MathHelper.Floor_double(entityplayer.posX) + world.rand .NextInt(32)) - world.rand.Next(32); int k = (net.minecraft.src.MathHelper.Floor_double(entityplayer.posZ) + world.rand .NextInt(32)) - world.rand.Next(32); int l = (net.minecraft.src.MathHelper.Floor_double(entityplayer.posY) + world.rand .NextInt(16)) - world.rand.Next(16); if (l < 1) { l = 1; } else { if (l > 128) { l = 128; } } int i1 = world.rand.Next(aclass.Length); int j1; for (j1 = l; j1 > 2 && !world.IsBlockNormalCube(j, j1 - 1, k); j1--) { } for (; !Func_21167_a(net.minecraft.src.EnumCreatureType.monster, world, j, j1, k) && j1 < l + 16 && j1 < 128; j1++) { } if (j1 >= l + 16 || j1 >= 128) { j1 = l; } else { float f = (float)j + 0.5F; float f1 = j1; float f2 = (float)k + 0.5F; net.minecraft.src.EntityLiving entityliving; try { entityliving = (net.minecraft.src.EntityLiving)(aclass[i1].GetConstructor(new System.Type[] { Sharpen.Runtime.GetClassForType(typeof(net.minecraft.src.World)) }).Invoke(new object[] { world })); } catch (System.Exception exception) { Sharpen.Runtime.PrintStackTrace(exception); return(flag); } entityliving.SetLocationAndAngles(f, f1, f2, world.rand.NextFloat() * 360F, 0.0F); if (entityliving.GetCanSpawnHere()) { net.minecraft.src.PathEntity pathentity = pathfinder.CreateEntityPathTo(entityliving , entityplayer, 32F); if (pathentity != null && pathentity.pathLength > 1) { net.minecraft.src.PathPoint pathpoint = pathentity.Func_22211_c(); if (System.Math.Abs((double)pathpoint.xCoord - entityplayer.posX) < 1.5D && System.Math .Abs((double)pathpoint.zCoord - entityplayer.posZ) < 1.5D && System.Math.Abs((double )pathpoint.yCoord - entityplayer.posY) < 1.5D) { net.minecraft.src.ChunkCoordinates chunkcoordinates = net.minecraft.src.BlockBed. Func_22021_g(world, net.minecraft.src.MathHelper.Floor_double(entityplayer.posX) , net.minecraft.src.MathHelper.Floor_double(entityplayer.posY), net.minecraft.src.MathHelper .Floor_double(entityplayer.posZ), 1); if (chunkcoordinates == null) { chunkcoordinates = new net.minecraft.src.ChunkCoordinates(j, j1 + 1, k); } entityliving.SetLocationAndAngles((float)chunkcoordinates.posX + 0.5F, chunkcoordinates .posY, (float)chunkcoordinates.posZ + 0.5F, 0.0F, 0.0F); world.AddEntity(entityliving); Func_21166_a(entityliving, world, (float)chunkcoordinates.posX + 0.5F, chunkcoordinates .posY, (float)chunkcoordinates.posZ + 0.5F); entityplayer.WakeUpPlayer(true, false, false); entityliving.PlayLivingSound(); flag = true; flag1 = true; } } } } i++; } } }while (true); return(flag); }