public virtual IItem[] GetDrops(IItem tool) { if (BlockMaterial.IsToolRequired() && !BlockMaterial.CanUseTool(tool.ItemType, tool.Material)) { return(new IItem[0]); } return(new IItem[] { new ItemBlock(BlockState) { Count = 1 } }); }
public double GetBreakTime(IItem miningTool) { double secondsForBreak = Hardness; bool isHarvestable = GetDrops(miningTool)?.Length > 0; if (BlockMaterial.IsToolRequired()) { isHarvestable = BlockMaterial.CanUseTool(miningTool.ItemType, miningTool.Material); } if (isHarvestable) { secondsForBreak *= 1.5; } else { secondsForBreak *= 5; } if (secondsForBreak == 0D) { secondsForBreak = 0.05; } int tierMultiplier = 1; if (BlockMaterial.CanUseTool(miningTool.ItemType, miningTool.Material)) { switch (miningTool.Material) { case ItemMaterial.Wood: tierMultiplier = 2; break; case ItemMaterial.Stone: tierMultiplier = 4; break; case ItemMaterial.Gold: tierMultiplier = 12; break; case ItemMaterial.Iron: tierMultiplier = 6; break; case ItemMaterial.Diamond: tierMultiplier = 8; break; } } if (isHarvestable) { switch (miningTool.ItemType) { case ItemType.Shears: if (this is Wool) { return(secondsForBreak / 5); } else if (this is Leaves || this is AcaciaLeaves || this is Cobweb) { return(secondsForBreak / 15); } break; case ItemType.Sword: if (this is Cobweb) { return(secondsForBreak / 15); } return(secondsForBreak / 1.5); case ItemType.Shovel: case ItemType.Axe: case ItemType.PickAxe: case ItemType.Hoe: return(secondsForBreak / tierMultiplier); } } return(secondsForBreak); }