Skip to content

Commit a7cd4c5

Browse files
added bucket recipe
1 parent b1cdb92 commit a7cd4c5

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

src/item/builtin/bucket.cpp

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include "player/player.h"
2424
#include "block/builtin/fluid.h"
2525
#include "block/builtin/water.h"
26+
#include "recipe/builtin/pattern.h"
27+
#include "item/builtin/minerals.h" // iron ingot
28+
2629
namespace programmerjake
2730
{
2831
namespace voxels
@@ -61,5 +64,43 @@ WaterBucket::WaterBucket()
6164
}
6265
}
6366
}
67+
68+
namespace Recipes
69+
{
70+
namespace builtin
71+
{
72+
class BucketRecipe final : public PatternRecipe<3, 2>
73+
{
74+
friend class global_instance_maker<BucketRecipe>;
75+
protected:
76+
virtual bool fillOutput(const RecipeInput &input, RecipeOutput &output) const override
77+
{
78+
if(input.getRecipeBlock().good() && input.getRecipeBlock().descriptor != Items::builtin::CraftingTable::descriptor())
79+
return false;
80+
output = RecipeOutput(ItemStack(Item(Items::builtin::Bucket::descriptor()), 1));
81+
return true;
82+
}
83+
private:
84+
BucketRecipe()
85+
: PatternRecipe(checked_array<Item, 3 * 2>
86+
{
87+
Item(Items::builtin::IronIngot::descriptor()), Item(), Item(Items::builtin::IronIngot::descriptor()),
88+
Item(), Item(Items::builtin::IronIngot::descriptor()), Item(),
89+
})
90+
{
91+
}
92+
public:
93+
static const BucketRecipe *pointer()
94+
{
95+
return global_instance_maker<BucketRecipe>::getInstance();
96+
}
97+
static RecipeDescriptorPointer descriptor()
98+
{
99+
return pointer();
100+
}
101+
};
102+
}
103+
}
104+
64105
}
65106
}

0 commit comments

Comments
 (0)