From 0043924179470f993da890be4365a8cf7f32907a Mon Sep 17 00:00:00 2001 From: Fireblade <72758695+Firebladedoge229@users.noreply.github.com> Date: Sat, 25 Apr 2026 20:03:12 -0400 Subject: [PATCH] feat: TU41 potion brewing adds brewing functionality for both jump boost potions + water breathing potions respectively --- .../Common/res/TitleUpdate/res/colours.col | Bin 5902 -> 5902 bytes .../Common/res/TitleUpdate/res/colours.xml | 2 +- Minecraft.World/BrewingStandMenu.cpp | 45 +++++++++++++++--- Minecraft.World/Item.cpp | 4 +- Minecraft.World/PotionBrewing.cpp | 4 ++ Minecraft.World/PotionBrewing.h | 2 + 6 files changed, 47 insertions(+), 10 deletions(-) diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.col b/Minecraft.Client/Common/res/TitleUpdate/res/colours.col index 06565ed6e71ee625799224878bf40d83dd2ebf42..60257b37afa73448bdca3a45227fce0f0b783624 100644 GIT binary patch delta 16 XcmeCv>(kqCl#f~Izt83qd~O^7I7kLV delta 16 XcmeCv>(kqCl#jV0Y5L|9d~O^7IBy0= diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml b/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml index 80c0f495..4e823132 100644 --- a/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml +++ b/Minecraft.Client/Common/res/TitleUpdate/res/colours.xml @@ -214,7 +214,7 @@ if __name__=="__main__": notecolors() - + diff --git a/Minecraft.World/BrewingStandMenu.cpp b/Minecraft.World/BrewingStandMenu.cpp index 2200f47c..d705f220 100644 --- a/Minecraft.World/BrewingStandMenu.cpp +++ b/Minecraft.World/BrewingStandMenu.cpp @@ -69,6 +69,34 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla Slot *PotionSlot2 = slots.at(BOTTLE_SLOT_START+1); Slot *PotionSlot3 = slots.at(BOTTLE_SLOT_START+2); + auto canShiftIntoIngredient = [&](shared_ptr stackToMove) -> bool + { + if (stackToMove == nullptr || !ingredientSlot->mayPlace(stackToMove)) + { + return false; + } + + if (!IngredientSlot->hasItem()) + { + return true; + } + + shared_ptr ingredientStack = IngredientSlot->getItem(); + if (ingredientStack == nullptr || ingredientStack->id != stackToMove->id) + { + return false; + } + + Item *ingredientBase = Item::items[ingredientStack->id]; + if (dynamic_cast(ingredientBase) != nullptr) + { + // pufferfish only + return stackToMove->getAuxValue() == 3; + } + + return true; + }; + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); @@ -99,8 +127,7 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr 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 BrewingStandMenu::quickMoveStack(shared_ptr 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 item) return item != nullptr && (item->id == Item::potion_Id || item->id == Item::glassBottle_Id); } - - BrewingStandMenu::IngredientsSlot::IngredientsSlot(shared_ptr container, int slot, int x, int y) : Slot(container, slot, x ,y) { } @@ -214,7 +238,14 @@ bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr item) { if (PotionBrewing::SIMPLIFIED_BREWING) { - return Item::items[item->id]->hasPotionBrewingFormula(); + Item* base = Item::items[item->id]; + + if (FishFoodItem* fish = dynamic_cast(base)) + { + return item->getAuxValue() == 3; + } + + return base->hasPotionBrewingFormula(); } else { diff --git a/Minecraft.World/Item.cpp b/Minecraft.World/Item.cpp index ed0bbbf3..f46a57e3 100644 --- a/Minecraft.World/Item.cpp +++ b/Minecraft.World/Item.cpp @@ -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((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); diff --git a/Minecraft.World/PotionBrewing.cpp b/Minecraft.World/PotionBrewing.cpp index f980977c..aa134edd 100644 --- a/Minecraft.World/PotionBrewing.cpp +++ b/Minecraft.World/PotionBrewing.cpp @@ -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" )); diff --git a/Minecraft.World/PotionBrewing.h b/Minecraft.World/PotionBrewing.h index 8f110c93..739881a3 100644 --- a/Minecraft.World/PotionBrewing.h +++ b/Minecraft.World/PotionBrewing.h @@ -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);