public byte CollideType(ExtBlock block) { BlockDefinition def = GetBlockDef(block); byte collide = def != null ? def.CollideType : MCGalaxy.Blocks.CollideType.Solid; if (def == null && !block.IsCustomType) { return(DefaultSet.Collide(Block.Convert(block.BlockID))); } return(collide); }
public byte CollideType(BlockID block) { BlockDefinition def = GetBlockDef(block); byte collide = def != null ? def.CollideType : MCGalaxy.Blocks.CollideType.Solid; if (def == null && block < Block.Extended) { return(DefaultSet.Collide(Block.Convert(block))); } return(collide); }
public static void ResetBlockProps(BlockID block) { BlocksLight[block] = DefaultSet.BlocksLight(block); FullBright[block] = DefaultSet.FullBright(block); FogColour[block] = DefaultSet.FogColour(block); FogDensity[block] = DefaultSet.FogDensity(block); SetCollide(block, DefaultSet.Collide(block)); DigSounds[block] = DefaultSet.DigSound(block); StepSounds[block] = DefaultSet.StepSound(block); SpeedMultiplier[block] = 1; Name[block] = DefaultName(block); Tinted[block] = false; SpriteOffset[block] = 0; Draw[block] = DefaultSet.Draw(block); if (Draw[block] == DrawType.Sprite) { MinBB[block] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[block] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; MaxBB[block].Y = DefaultSet.Height(block); } SetBlockDraw(block, Draw[block]); CalcRenderBounds(block); LightOffset[block] = CalcLightOffset(block); if (block >= Block.CpeCount) { #if USE16_BIT // give some random texture ids SetTex((block * 10 + (block % 7) + 20) % 80, Side.Top, block); SetTex((block * 8 + (block & 5) + 5) % 80, Side.Bottom, block); SetSide((block * 4 + (block / 4) + 4) % 80, block); #else SetTex(0, Side.Top, block); SetTex(0, Side.Bottom, block); SetSide(0, block); #endif } else { SetTex(topTex[block], Side.Top, block); SetTex(bottomTex[block], Side.Bottom, block); SetSide(sideTex[block], block); } }
/// <summary> Resets the properties for the given block to their defaults. </summary> public void ResetBlockProps(BlockID id) { BlocksLight[id] = DefaultSet.BlocksLight(id); FullBright[id] = DefaultSet.FullBright(id); FogColour[id] = DefaultSet.FogColour(id); FogDensity[id] = DefaultSet.FogDensity(id); Collide[id] = DefaultSet.Collide(id); DigSounds[id] = DefaultSet.DigSound(id); StepSounds[id] = DefaultSet.StepSound(id); SpeedMultiplier[id] = 1; Name[id] = DefaultName(id); Tinted[id] = false; Draw[id] = DefaultSet.Draw(id); if (Draw[id] == DrawType.Sprite) { MinBB[id] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[id] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[id] = Vector3.Zero; MaxBB[id] = Vector3.One; MaxBB[id].Y = DefaultSet.Height(id); } SetBlockDraw(id, Draw[id]); CalcRenderBounds(id); LightOffset[id] = CalcLightOffset(id); if (id >= Block.CpeCount) { #if USE16_BIT // give some random texture ids SetTex((id * 10 + (id % 7) + 20) % 80, Side.Top, id); SetTex((id * 8 + (id & 5) + 5) % 80, Side.Bottom, id); SetSide((id * 4 + (id / 4) + 4) % 80, id); #else SetTex(0, Side.Top, id); SetTex(0, Side.Bottom, id); SetSide(0, id); #endif } else { SetTex(topTex[id], Side.Top, id); SetTex(bottomTex[id], Side.Bottom, id); SetSide(sideTex[id], id); } }
public static void ResetBlockProps(BlockID block) { BlocksLight[block] = DefaultSet.BlocksLight(block); FullBright[block] = DefaultSet.FullBright(block); FogCol[block] = DefaultSet.FogColour(block); FogDensity[block] = DefaultSet.FogDensity(block); SetCollide(block, DefaultSet.Collide(block)); DigSounds[block] = DefaultSet.DigSound(block); StepSounds[block] = DefaultSet.StepSound(block); SpeedMultiplier[block] = 1; Name[block] = DefaultName(block); Tinted[block] = false; SpriteOffset[block] = 0; Draw[block] = DefaultSet.Draw(block); if (Draw[block] == DrawType.Sprite) { MinBB[block] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[block] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; MaxBB[block].Y = DefaultSet.Height(block); } SetBlockDraw(block, Draw[block]); CalcRenderBounds(block); CalcLightOffset(block); if (block >= Block.CpeCount) { SetTex(0, Side.Top, block); SetTex(0, Side.Bottom, block); SetSide(0, block); } else { SetTex(topTex[block], Side.Top, block); SetTex(bottomTex[block], Side.Bottom, block); SetSide(sideTex[block], block); } }
public void ResetBlockProps(byte id) { BlocksLight[id] = DefaultSet.BlocksLight(id); FullBright[id] = DefaultSet.FullBright(id); CullWithNeighbours[id] = id != Block.Leaves; FogColour[id] = DefaultSet.FogColour(id); FogDensity[id] = DefaultSet.FogDensity(id); Collide[id] = DefaultSet.Collide(id); DigSounds[id] = DefaultSet.DigSound(id); StepSounds[id] = DefaultSet.StepSound(id); SetBlockDraw(id, DefaultSet.Draw(id)); SpeedMultiplier[id] = 1; Name[id] = DefaultName(id); if (IsSprite[id]) { MinBB[id] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[id] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[id] = Vector3.Zero; MaxBB[id] = Vector3.One; MaxBB[id].Y = DefaultSet.Height(id); } LightOffset[id] = CalcLightOffset(id); if (id >= Block.CpeCount) { SetTex(0, Side.Top, id); SetTex(0, Side.Bottom, id); SetSide(0, id); } else { SetTex(topTex[id], Side.Top, id); SetTex(bottomTex[id], Side.Bottom, id); SetSide(sideTex[id], id); } }
public static void ResetBlockProps(BlockID block) { BlocksLight[block] = DefaultSet.BlocksLight(block); FullBright[block] = DefaultSet.FullBright(block); FogColour[block] = DefaultSet.FogColour(block); FogDensity[block] = DefaultSet.FogDensity(block); SetCollide(block, DefaultSet.Collide(block)); DigSounds[block] = DefaultSet.DigSound(block); StepSounds[block] = DefaultSet.StepSound(block); SpeedMultiplier[block] = 1; Name[block] = DefaultName(block); Tinted[block] = false; SpriteOffset[block] = 0; Draw[block] = DefaultSet.Draw(block); if (Draw[block] == DrawType.Sprite) { MinBB[block] = new Vector3(2.50f / 16f, 0, 2.50f / 16f); MaxBB[block] = new Vector3(13.5f / 16f, 1, 13.5f / 16f); } else { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; MaxBB[block].Y = DefaultSet.Height(block); } #if ALPHA if (block == Block.SugarCane) { MinBB[block] = Vector3.Zero; MaxBB[block] = Vector3.One; } else if (block == Block.Torch || block == Block.RedstoneTorchOff || block == Block.RedstoneTorchOn) { MinBB[block] = new Vector3(7f / 16f, 0, 7f / 16f); MaxBB[block] = new Vector3(9f / 16f, 10f / 16f, 9f / 16f); } else if (block == Block.Ladder) { MinBB[block] = new Vector3(0, 0, 0); MaxBB[block] = new Vector3(1, 1, 2 / 16f); } else if (block == Block.StonePressurePlate || block == Block.WoodPressurePlate) { MinBB[block] = new Vector3(1 / 16f, 0, 1 / 16f); MaxBB[block] = new Vector3(15 / 16f, 1 / 16f, 15 / 16f); } else if (block == Block.Cactus) { MinBB[block] = new Vector3(1 / 16f, 0, 1 / 16f); MaxBB[block] = new Vector3(15 / 16f, 1, 15 / 16f); } else if (block == Block.Fence) { MinBB[block] = new Vector3(6 / 16f, 0, 6 / 16f); MaxBB[block] = new Vector3(10 / 16f, 1, 10 / 16f); } CanStretch[Block.Redstone] = 0; #endif SetBlockDraw(block, Draw[block]); CalcRenderBounds(block); LightOffset[block] = CalcLightOffset(block); if (block >= Block.CpeCount) { #if USE16_BIT // give some random texture ids SetTex((block * 10 + (block % 7) + 20) % 80, Side.Top, block); SetTex((block * 8 + (block & 5) + 5) % 80, Side.Bottom, block); SetSide((block * 4 + (block / 4) + 4) % 80, block); #else SetTex(0, Side.Top, block); SetTex(0, Side.Bottom, block); SetSide(0, block); #endif } else { SetTex(topTex[block], Side.Top, block); SetTex(bottomTex[block], Side.Bottom, block); SetSide(sideTex[block], block); #if ALPHA if (block == Block.Chest) { SetTex(27, Side.Back, block); } else if (block == Block.CraftingTable) { SetTex(59, Side.Back, block); SetTex(59, Side.Right, block); } #endif } }