feat: TU41 potion brewing

adds brewing functionality for both jump boost potions + water breathing potions respectively
This commit is contained in:
Fireblade 2026-04-25 20:03:12 -04:00
parent 8159e7690b
commit 0043924179
6 changed files with 47 additions and 10 deletions

View file

@ -214,7 +214,7 @@ if __name__=="__main__": notecolors()
<colour name="Effect_DamageBoost" value="932423"/>
<colour name="Effect_Heal" value="f82423"/>
<colour name="Effect_Harm" value="430a09"/>
<colour name="Effect_Jump" value="786297"/>
<colour name="Effect_Jump" value="22ff4c"/>
<colour name="Effect_Confusion" value="551d4a"/>
<colour name="Effect_Regeneration" value="cd5cab"/>
<colour name="Effect_DamageResistance" value="99453a"/>

View file

@ -69,6 +69,34 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
Slot *PotionSlot2 = slots.at(BOTTLE_SLOT_START+1);
Slot *PotionSlot3 = slots.at(BOTTLE_SLOT_START+2);
auto canShiftIntoIngredient = [&](shared_ptr<ItemInstance> stackToMove) -> bool
{
if (stackToMove == nullptr || !ingredientSlot->mayPlace(stackToMove))
{
return false;
}
if (!IngredientSlot->hasItem())
{
return true;
}
shared_ptr<ItemInstance> ingredientStack = IngredientSlot->getItem();
if (ingredientStack == nullptr || ingredientStack->id != stackToMove->id)
{
return false;
}
Item *ingredientBase = Item::items[ingredientStack->id];
if (dynamic_cast<FishFoodItem*>(ingredientBase) != nullptr)
{
// pufferfish only
return stackToMove->getAuxValue() == 3;
}
return true;
};
if (slot != nullptr && slot->hasItem())
{
shared_ptr<ItemInstance> stack = slot->getItem();
@ -99,8 +127,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
else if (slotIndex >= INV_SLOT_START && slotIndex < INV_SLOT_END)
{
// 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot
if( (Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherwart_seeds_Id) ) &&
(!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ) )
if (canShiftIntoIngredient(stack))
{
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
{
@ -123,8 +150,7 @@ shared_ptr<ItemInstance> BrewingStandMenu::quickMoveStack(shared_ptr<Player> pla
else if (slotIndex >= USE_ROW_SLOT_START && slotIndex < USE_ROW_SLOT_END)
{
// 4J-PB - if the item is an ingredient, quickmove it into the ingredient slot
if((Item::items[stack->id]->hasPotionBrewingFormula() || (stack->id == Item::netherwart_seeds_Id)) &&
(!IngredientSlot->hasItem() || (stack->id==IngredientSlot->getItem()->id) ))
if (canShiftIntoIngredient(stack))
{
if(!moveItemStackTo(stack, INGREDIENT_SLOT, INGREDIENT_SLOT+1, false))
{
@ -202,8 +228,6 @@ bool BrewingStandMenu::PotionSlot::mayPlaceItem(shared_ptr<ItemInstance> item)
return item != nullptr && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id);
}
BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr<Container> container, int slot, int x, int y) : Slot(container, slot, x ,y)
{
}
@ -214,7 +238,14 @@ bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr<ItemInstance> item)
{
if (PotionBrewing::SIMPLIFIED_BREWING)
{
return Item::items[item->id]->hasPotionBrewingFormula();
Item* base = Item::items[item->id];
if (FishFoodItem* fish = dynamic_cast<FishFoodItem*>(base))
{
return item->getAuxValue() == 3;
}
return base->hasPotionBrewingFormula();
}
else
{

View file

@ -403,7 +403,7 @@ void Item::staticCtor()
Item::egg = ( new EggItem(88) ) ->setIconName(L"egg")->setDescriptionId(IDS_ITEM_EGG)->setUseDescriptionId(IDS_DESC_EGG);
Item::fishingRod = static_cast<FishingRodItem *>((new FishingRodItem(90))->setBaseItemTypeAndMaterial(eBaseItemType_rod, eMaterial_wood)->setIconName(L"fishingRod")->setDescriptionId(IDS_ITEM_FISHING_ROD)->setUseDescriptionId(IDS_DESC_FISHINGROD));
Item::yellowDust = ( new Item(92) ) ->setIconName(L"yellowDust")->setDescriptionId(IDS_ITEM_YELLOW_DUST)->setUseDescriptionId(IDS_DESC_YELLOW_DUST)->setPotionBrewingFormula(PotionBrewing::MOD_GLOWSTONE);
Item::fish_raw = ( new FishFoodItem(93, false) ) ->setIconName(L"fishRaw")->setDescriptionId(IDS_ITEM_FISH_RAW)->setUseDescriptionId(IDS_DESC_FISH_RAW)->setStackedByData(true);
Item::fish_raw = ( new FishFoodItem(93, false) ) ->setIconName(L"fishRaw")->setDescriptionId(IDS_ITEM_FISH_RAW)->setUseDescriptionId(IDS_DESC_FISH_RAW)->setStackedByData(true)->setPotionBrewingFormula(PotionBrewing::MOD_PUFFERFISH);
Item::fish_cooked = (new FishFoodItem(94, true)) ->setIconName(L"fishCooked")->setDescriptionId(IDS_ITEM_FISH_COOKED)->setUseDescriptionId(IDS_DESC_FISH_COOKED)->setStackedByData(true);
Item::dye_powder = ( new DyePowderItem(95) ) ->setBaseItemTypeAndMaterial(eBaseItemType_dyepowder, eMaterial_dye)->setIconName(L"dyePowder")->setDescriptionId(IDS_ITEM_DYE_POWDER)->setUseDescriptionId(-1);
@ -535,7 +535,7 @@ void Item::staticCtor()
Item::door_dark = (new DoorItem(175, Material::wood, L"doorDark"))->setBaseItemTypeAndMaterial(eBaseItemType_door, eMaterial_wood)->setIconName(L"doorDark")->setDescriptionId(IDS_ITEM_DOOR_DARK)->setUseDescriptionId(IDS_DESC_DOOR_WOOD);
Item::rabbit_hide = ( new Item(159) ) ->setIconName(L"rabbitHide")->setDescriptionId(IDS_ITEM_RABBIT_HIDE)->setUseDescriptionId(IDS_DESC_RABBIT_HIDE);
Item::rabbits_foot = ( new Item(158) ) ->setIconName(L"rabbitsFoot")->setDescriptionId(IDS_ITEM_RABBIT_FOOT)->setUseDescriptionId(IDS_DESC_RABBIT_FOOT);
Item::rabbits_foot = ( new Item(158) ) ->setIconName(L"rabbitsFoot")->setDescriptionId(IDS_ITEM_RABBIT_FOOT)->setUseDescriptionId(IDS_DESC_RABBIT_FOOT)->setPotionBrewingFormula(PotionBrewing::MOD_RABBITS_FOOT);;
Item::armor_stand = (new ArmorStandItem(160)) ->setBaseItemTypeAndMaterial(eBaseItemType_HangingItem,eMaterial_cloth)->setIconName(L"armorStand")->setDescriptionId(IDS_ITEM_ARMOR_STAND)->setUseDescriptionId(IDS_DESC_ARMOR_STAND);
Item::prismarine_crystal = (new Item(154))->setIconName(L"prismarineCrystal")->setDescriptionId(IDS_ITEM_PRISMARINE_CRYSTAL)->setUseDescriptionId(IDS_ITEM_PRISMARINE_CRYSTAL_DESC);

View file

@ -81,6 +81,8 @@ const wstring PotionBrewing::MOD_REDSTONE = L"-5+6-7"; // redstone increases dur
const wstring PotionBrewing::MOD_GLOWSTONE = L"+5-6-7"; // glowstone increases amplification
// 4J Stu - Don't require bit 13 to be set. We don't use it in the creative menu. Side effect is you can make a (virtually useless) Splash Mundane potion with water bottle and gunpowder
const wstring PotionBrewing::MOD_GUNPOWDER = L"+14";//&13-13"; // gunpowder makes them throwable! // gunpowder requires 13 and sets 14
const wstring PotionBrewing::MOD_RABBITS_FOOT = L"+0+1-2+3&4-4+13";
const wstring PotionBrewing::MOD_PUFFERFISH = L"+0+1+2+3&4-4+13";
#else
const wstring PotionBrewing::MOD_WATER = L"-1-3-5-7-9-11-13";
const wstring PotionBrewing::MOD_SUGAR = L"+0";
@ -114,6 +116,8 @@ void PotionBrewing::staticCtor()
potionEffectDuration.insert(intStringMap::value_type( MobEffect::damageBoost->getId(), L"0 & !1 & !2 & 3 & 3+6" ));
potionEffectDuration.insert(intStringMap::value_type( MobEffect::nightVision->getId(), L"!0 & 1 & 2 & !3 & 2+6" ));
potionEffectDuration.insert(intStringMap::value_type( MobEffect::invisibility->getId(), L"!0 & 1 & 2 & 3 & 2+6" ));
potionEffectDuration.insert(intStringMap::value_type( MobEffect::jump->getId(), L"0 & 1 & !2 & 3 & 0+6" ));
potionEffectDuration.insert(intStringMap::value_type( MobEffect::waterBreathing->getId(), L"0 & 1 & 2 & 3 & 0+6" ));
// glowstone increases amplification
potionEffectAmplifier.insert(intStringMap::value_type( MobEffect::movementSpeed->getId(), L"5" ));

View file

@ -35,6 +35,8 @@ public:
static const wstring MOD_NETHERWART;
static const wstring MOD_GUNPOWDER;
static const wstring MOD_GOLDENCARROT;
static const wstring MOD_RABBITS_FOOT;
static const wstring MOD_PUFFERFISH;
static const int BITS_FOR_MAX_NORMAL_EFFECT = 0xF;
static const int BITS_FOR_DURATION = (1 << 5);