public override IEnumerable <CraftingRecipe> GetProceduralCraftingRecipes() { int isDead = 0; while (isDead <= 1) { int num; for (int rot = 0; rot <= 1; rot = num) { CraftingRecipe craftingRecipe = new CraftingRecipe { ResultCount = 1, ResultValue = 251, RequiredHeatLevel = 1f, Description = "еКБ©до╧ожЮ" }; int data = BasePumpkinBlock.SetIsDead(BasePumpkinBlock.SetSize(0, 7), isDead != 0); int value = SetDamage(Terrain.MakeBlockValue(131, 0, data), rot); craftingRecipe.Ingredients[0] = "pumpkin:" + Terrain.ExtractData(value).ToString(CultureInfo.InvariantCulture); craftingRecipe.Ingredients[1] = "waterbucket"; yield return(craftingRecipe); num = rot + 1; } num = isDead + 1; isDead = num; } }
public override void GetDropValues(SubsystemTerrain subsystemTerrain, int oldValue, int newValue, int toolLevel, List <BlockDropValue> dropValues, out bool showDebris) { base.GetDropValues(subsystemTerrain, oldValue, newValue, toolLevel, dropValues, out showDebris); int data = Terrain.ExtractData(oldValue); if (BasePumpkinBlock.GetSize(data) == 7 && !BasePumpkinBlock.GetIsDead(data) && Random.Bool(0.5f)) { dropValues.Add(new BlockDropValue { Value = 248, Count = 1 }); } }
public override BlockPlacementData GetPlacementValue(SubsystemTerrain subsystemTerrain, ComponentMiner componentMiner, int value, TerrainRaycastResult raycastResult) { BlockPlacementData result = default(BlockPlacementData); result.CellFace = raycastResult.CellFace; if (raycastResult.CellFace.Face == 4) { switch (Terrain.ExtractData(value)) { case 0: result.Value = Terrain.MakeBlockValue(19, 0, TallGrassBlock.SetIsSmall(0, isSmall: true)); break; case 1: result.Value = Terrain.MakeBlockValue(20, 0, FlowerBlock.SetIsSmall(0, isSmall: true)); break; case 2: result.Value = Terrain.MakeBlockValue(24, 0, FlowerBlock.SetIsSmall(0, isSmall: true)); break; case 3: result.Value = Terrain.MakeBlockValue(25, 0, FlowerBlock.SetIsSmall(0, isSmall: true)); break; case 4: result.Value = Terrain.MakeBlockValue(174, 0, RyeBlock.SetSize(RyeBlock.SetIsWild(0, isWild: false), 0)); break; case 5: result.Value = Terrain.MakeBlockValue(174, 0, RyeBlock.SetSize(RyeBlock.SetIsWild(0, isWild: false), 0)); break; case 6: result.Value = Terrain.MakeBlockValue(204, 0, CottonBlock.SetSize(CottonBlock.SetIsWild(0, isWild: false), 0)); break; case 7: result.Value = Terrain.MakeBlockValue(131, 0, BasePumpkinBlock.SetSize(BasePumpkinBlock.SetIsDead(0, isDead: false), 0)); break; } } return(result); }
public void GrowPumpkin(int value, int x, int y, int z, int pollPass) { if (Terrain.ExtractLight(base.SubsystemTerrain.Terrain.GetCellValueFast(x, y + 1, z)) < 9) { return; } int data = Terrain.ExtractData(value); int size = BasePumpkinBlock.GetSize(data); if (BasePumpkinBlock.GetIsDead(data) || size >= 7) { return; } int cellValueFast = base.SubsystemTerrain.Terrain.GetCellValueFast(x, y - 1, z); int num = Terrain.ExtractContents(cellValueFast); int data2 = Terrain.ExtractData(cellValueFast); bool flag = num == 168 && SoilBlock.GetHydration(data2); int num2 = (num == 168) ? SoilBlock.GetNitrogen(data2) : 0; int num3 = 4; float num4 = 0.15f; if (num == 168) { num3--; num4 -= 0.05f; } if (num2 > 0) { num3--; num4 -= 0.05f; } if (flag) { num3--; num4 -= 0.05f; } if (pollPass % MathUtils.Max(num3, 1) == 0) { int data3 = BasePumpkinBlock.SetSize(data, MathUtils.Min(size + 1, 7)); if (m_random.Float(0f, 1f) < num4) { data3 = BasePumpkinBlock.SetIsDead(data3, isDead: true); } int value2 = Terrain.ReplaceData(value, data3); Replacement value3 = m_toReplace[new Point3(x, y, z)] = new Replacement { Value = value2, RequiredValue = value }; if (num == 168 && size + 1 == 7) { int data4 = SoilBlock.SetNitrogen(data2, MathUtils.Max(num2 - 3, 0)); int value4 = Terrain.ReplaceData(cellValueFast, data4); Dictionary <Point3, Replacement> toReplace = m_toReplace; Point3 key = new Point3(x, y - 1, z); value3 = new Replacement { Value = value4, RequiredValue = cellValueFast }; toReplace[key] = value3; } } }