diff --git a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu1080.swf b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu1080.swf index 0aa8d2d3..6b3b956d 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu1080.swf and b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu1080.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu480.swf b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu480.swf index 000dfe02..cd3c3fd9 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu480.swf and b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu480.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu720.swf b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu720.swf index 178b3e16..4ac31959 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu720.swf and b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenu720.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit1080.swf b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit1080.swf index 71e95d90..48f212ca 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit1080.swf and b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit1080.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit720.swf b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit720.swf index 97a9c6f0..61f644be 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit720.swf and b/Minecraft.Client/Common/Media/MediaWindows64/BrewingStandMenuSplit720.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsInGame.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsInGame.swf index 639f5bda..70276761 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsInGame.swf and b/Minecraft.Client/Common/Media/MediaWindows64/skinGraphicsInGame.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinHDGraphicsInGame.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinHDGraphicsInGame.swf index 77111b40..d837b7a3 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/skinHDGraphicsInGame.swf and b/Minecraft.Client/Common/Media/MediaWindows64/skinHDGraphicsInGame.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinHDInGame.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinHDInGame.swf index da56df72..d9474b0f 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/skinHDInGame.swf and b/Minecraft.Client/Common/Media/MediaWindows64/skinHDInGame.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/skinInGame.swf b/Minecraft.Client/Common/Media/MediaWindows64/skinInGame.swf index fd3147b6..518ac51c 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/skinInGame.swf and b/Minecraft.Client/Common/Media/MediaWindows64/skinInGame.swf differ diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h index 5ff21977..1d34dad9 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h @@ -80,6 +80,7 @@ protected: eSectionBrewingBottle2, eSectionBrewingBottle3, eSectionBrewingIngredient, + eSectionBrewingPlate, eSectionBrewingMax, eSectionAnvilUsing, diff --git a/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.cpp index a1ffaedd..e87d1268 100644 --- a/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.cpp @@ -68,6 +68,22 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAn newSection = eSectionBrewingBottle1; } break; + case eSectionBrewingPlate: + if (eTapDirection == eTapStateRight) + { + newSection = eSectionBrewingIngredient; + } + else if (eTapDirection == eTapStateDown) + { + newSection = eSectionBrewingBottle1; + } + else if (eTapDirection == eTapStateUp) + { + newSection = eSectionBrewingUsing; + xOffset = BREWING_SCENE_PLATE_SLOT_UP_OFFSET; + } + break; + case eSectionBrewingIngredient: if(eTapDirection == eTapStateUp) { @@ -78,6 +94,10 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAn { newSection = eSectionBrewingBottle2; } + else if (eTapDirection == eTapStateLeft) + { + newSection = eSectionBrewingPlate; + } break; case eSectionBrewingInventory: if(eTapDirection == eTapStateDown) @@ -86,7 +106,11 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAn } else if(eTapDirection == eTapStateUp) { - if( *piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET) + if (*piTargetX <= BREWING_SCENE_PLATE_SLOT_UP_THRESHOLD) + { + newSection = eSectionBrewingPlate; + } + else if( *piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET) { newSection = eSectionBrewingBottle1; } @@ -106,8 +130,15 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::GetSectionAn newSection = eSectionBrewingInventory; } else if(eTapDirection == eTapStateDown) - { - newSection = eSectionBrewingIngredient; + { + if (*piTargetX <= BREWING_SCENE_PLATE_SLOT_UP_OFFSET) + { + newSection = eSectionBrewingPlate; + } + else + { + newSection = eSectionBrewingIngredient; + } } break; default: @@ -134,6 +165,9 @@ int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection) case eSectionBrewingBottle3: offset = BrewingStandMenu::BOTTLE_SLOT_START + 2; break; + case eSectionBrewingPlate: + offset = BrewingStandMenu::FUEL_SLOT; + break; case eSectionBrewingIngredient: offset = BrewingStandMenu::INGREDIENT_SLOT; break; diff --git a/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.h b/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.h index 2d5150bb..212676c4 100644 --- a/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_BrewingMenu.h @@ -2,6 +2,8 @@ #include "IUIScene_AbstractContainerMenu.h" // The 0-indexed slot in the inventory list that lines up with the result slot +#define BREWING_SCENE_PLATE_SLOT_UP_OFFSET 1 +#define BREWING_SCENE_PLATE_SLOT_UP_THRESHOLD 1 #define BREWING_SCENE_INGREDIENT_SLOT_UP_OFFSET 5 #define BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET 5 #define BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET 3 diff --git a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp index a82620ad..2bda85de 100644 --- a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp @@ -11,6 +11,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI // Setup all the Iggy references we need for this scene initialiseMovie(); + m_progressBrewingPlateBar.init(L"", 0, 0, BREWING_STAND_MAX_FUEL, 0); m_progressBrewingArrow.init(L"",0,0,PotionBrewing::BREWING_TIME_SECONDS * SharedConstants::TICKS_PER_SECOND,0); m_progressBrewingBubbles.init(L"",0,0,30,0); @@ -32,6 +33,7 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI Initialize( initData->iPad, menu, true, BrewingStandMenu::INV_SLOT_START, eSectionBrewingUsing, eSectionBrewingMax ); m_slotListIngredient.addSlots(BrewingStandMenu::INGREDIENT_SLOT, 1); + m_slotBrewingPlate.addSlots(BrewingStandMenu::FUEL_SLOT, 1); for(unsigned int i = 0; i < 3; ++i) { @@ -60,6 +62,7 @@ void UIScene_BrewingStandMenu::handleReload() Initialize( m_iPad, m_menu, true, BrewingStandMenu::INV_SLOT_START, eSectionBrewingUsing, eSectionBrewingMax ); m_slotListIngredient.addSlots(BrewingStandMenu::INGREDIENT_SLOT, 1); + m_slotBrewingPlate.addSlots(BrewingStandMenu::FUEL_SLOT, 1); for(unsigned int i = 0; i < 3; ++i) { @@ -70,6 +73,8 @@ void UIScene_BrewingStandMenu::handleReload() void UIScene_BrewingStandMenu::tick() { m_progressBrewingArrow.setProgress( m_brewingStand->getBrewTime() ); + m_progressBrewingPlateBar.setProgress( m_brewingStand->getBrewFuel() ); + m_progressBrewingPlateBar.showBar(true); int value = 0; int bubbleStep = (m_brewingStand->getBrewTime() / 2) % 7; @@ -118,6 +123,9 @@ int UIScene_BrewingStandMenu::getSectionColumns(ESceneSection eSection) case eSectionBrewingIngredient: cols = 1; break; + case eSectionBrewingPlate: + cols = 1; + break; case eSectionBrewingInventory: cols = 9; break; @@ -148,6 +156,9 @@ int UIScene_BrewingStandMenu::getSectionRows(ESceneSection eSection) case eSectionBrewingIngredient: rows = 1; break; + case eSectionBrewingPlate: + rows = 1; + break; case eSectionBrewingInventory: rows = 3; break; @@ -181,6 +192,10 @@ void UIScene_BrewingStandMenu::GetPositionOfSection( ESceneSection eSection, UIV pPosition->x = m_slotListIngredient.getXPos(); pPosition->y = m_slotListIngredient.getYPos(); break; + case eSectionBrewingPlate: + pPosition->x = m_slotBrewingPlate.getXPos(); + pPosition->y = m_slotBrewingPlate.getYPos(); + break; case eSectionBrewingInventory: pPosition->x = m_slotListInventory.getXPos(); pPosition->y = m_slotListInventory.getYPos(); @@ -217,6 +232,10 @@ void UIScene_BrewingStandMenu::GetItemScreenData( ESceneSection eSection, int iI sectionSize.x = m_slotListIngredient.getWidth(); sectionSize.y = m_slotListIngredient.getHeight(); break; + case eSectionBrewingPlate: + sectionSize.x = m_slotBrewingPlate.getWidth(); + sectionSize.y = m_slotBrewingPlate.getHeight(); + break; case eSectionBrewingInventory: sectionSize.x = m_slotListInventory.getWidth(); sectionSize.y = m_slotListInventory.getHeight(); @@ -264,6 +283,9 @@ void UIScene_BrewingStandMenu::setSectionSelectedSlot(ESceneSection eSection, in case eSectionBrewingIngredient: slotList = &m_slotListIngredient; break; + case eSectionBrewingPlate: + slotList = &m_slotBrewingPlate; + break; case eSectionBrewingInventory: slotList = &m_slotListInventory; break; @@ -295,6 +317,9 @@ UIControl *UIScene_BrewingStandMenu::getSection(ESceneSection eSection) case eSectionBrewingIngredient: control = &m_slotListIngredient; break; + case eSectionBrewingPlate: + control = &m_slotBrewingPlate; + break; case eSectionBrewingInventory: control = &m_slotListInventory; break; diff --git a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.h b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.h index 5441a1ac..12af29a3 100644 --- a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.h @@ -8,6 +8,7 @@ class InventoryMenu; class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu { private: + static const int BREWING_STAND_MAX_FUEL = 20; shared_ptr m_brewingStand; public: @@ -16,20 +17,22 @@ public: virtual EUIScene getSceneType() { return eUIScene_BrewingStandMenu;} protected: - UIControl_SlotList m_slotListBottles[3], m_slotListIngredient; + UIControl_SlotList m_slotListBottles[3], m_slotListIngredient, m_slotBrewingPlate; UIControl_Label m_labelBrewingStand; - UIControl_Progress m_progressBrewingArrow, m_progressBrewingBubbles; + UIControl_Progress m_progressBrewingArrow, m_progressBrewingBubbles, m_progressBrewingPlateBar; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu) UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel ) UI_MAP_ELEMENT( m_slotListBottles[0], "Bottle1") UI_MAP_ELEMENT( m_slotListBottles[1], "Bottle2") UI_MAP_ELEMENT( m_slotListBottles[2], "Bottle3") + UI_MAP_ELEMENT( m_slotBrewingPlate, "BrewingPlate") UI_MAP_ELEMENT( m_slotListIngredient, "Ingredient") UI_MAP_ELEMENT( m_labelBrewingStand, "BrewingStandText") UI_MAP_ELEMENT( m_progressBrewingArrow, "BrewingArrow") UI_MAP_ELEMENT( m_progressBrewingBubbles, "BrewingBubbles") + UI_MAP_ELEMENT( m_progressBrewingPlateBar, "BrewingPlateBar") UI_END_MAP_CHILD_ELEMENTS() UI_END_MAP_ELEMENTS_AND_NAMES() diff --git a/Minecraft.Client/ServerPlayer.cpp b/Minecraft.Client/ServerPlayer.cpp index 9cbaedb0..cf249583 100644 --- a/Minecraft.Client/ServerPlayer.cpp +++ b/Minecraft.Client/ServerPlayer.cpp @@ -1490,6 +1490,7 @@ bool ServerPlayer::openBrewingStand(shared_ptr brewing_s #endif connection->send(std::make_shared(containerCounter, ContainerOpenPacket::BREWING_STAND, brewing_stand->getCustomName(), brewing_stand->getContainerSize(), brewing_stand->hasCustomName())); refreshContainer(containerMenu); + containerMenu->broadcastChanges(); } else { diff --git a/Minecraft.World/BrewingStandMenu.cpp b/Minecraft.World/BrewingStandMenu.cpp index 0bb9aff9..4c77b5c0 100644 --- a/Minecraft.World/BrewingStandMenu.cpp +++ b/Minecraft.World/BrewingStandMenu.cpp @@ -16,6 +16,7 @@ BrewingStandMenu::BrewingStandMenu(shared_ptr inventory, shared_ptr( inventory->player->shared_from_this() ), brewingStand, 1, 79, 53)); addSlot(new PotionSlot(dynamic_pointer_cast( inventory->player->shared_from_this() ), brewingStand, 2, 102, 46)); ingredientSlot = addSlot(new IngredientsSlot(brewingStand, 3, 79, 17)); + fuelSlot = addSlot(new Slot(brewingStand, 4, 50, 70)); for (int y = 0; y < 3; y++) { @@ -34,6 +35,7 @@ void BrewingStandMenu::addSlotListener(ContainerListener *listener) { AbstractContainerMenu::addSlotListener(listener); listener->setContainerData(this, 0, brewingStand->getBrewTime()); + listener->setContainerData(this, 1, brewingStand->getBrewFuel()); } void BrewingStandMenu::broadcastChanges() @@ -42,10 +44,11 @@ void BrewingStandMenu::broadcastChanges() for( auto& listener : containerListeners ) { - if (tc != brewingStand->getBrewTime()) - { + if (tc != brewingStand->getBrewTime()) { listener->setContainerData(this, 0, brewingStand->getBrewTime()); } + + listener->setContainerData(this, 1, brewingStand->getBrewFuel()); } tc = brewingStand->getBrewTime(); } @@ -53,6 +56,7 @@ void BrewingStandMenu::broadcastChanges() void BrewingStandMenu::setData(int id, int value) { if (id == 0) brewingStand->setBrewTime(value); + if (id == 1) brewingStand->setBrewFuel(value); } bool BrewingStandMenu::stillValid(shared_ptr player) @@ -97,12 +101,17 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla return true; }; + auto canShiftIntoFuel = [&](shared_ptr stackToMove) -> bool + { + return fuelSlot->mayPlace(stackToMove); + }; + if (slot != nullptr && slot->hasItem()) { shared_ptr stack = slot->getItem(); clicked = stack->copy(); - if ((slotIndex >= BOTTLE_SLOT_START && slotIndex <= BOTTLE_SLOT_END) || (slotIndex == INGREDIENT_SLOT)) + if ((slotIndex >= BOTTLE_SLOT_START && slotIndex <= BOTTLE_SLOT_END) || (slotIndex == INGREDIENT_SLOT) || (slotIndex == FUEL_SLOT)) { if (!moveItemStackTo(stack, INV_SLOT_START, USE_ROW_SLOT_END, true)) { @@ -142,6 +151,13 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla return nullptr; } } + else if (canShiftIntoFuel(stack)) + { + if(!moveItemStackTo(stack, FUEL_SLOT, FUEL_SLOT+1, false)) + { + return nullptr; + } + } else if (!moveItemStackTo(stack, USE_ROW_SLOT_START, USE_ROW_SLOT_END, false)) { return nullptr; @@ -165,6 +181,13 @@ shared_ptr BrewingStandMenu::quickMoveStack(shared_ptr pla return nullptr; } } + else if (canShiftIntoFuel(stack)) + { + if (!moveItemStackTo(stack, FUEL_SLOT, FUEL_SLOT + 1, false)) + { + return nullptr; + } + } else if (!moveItemStackTo(stack, INV_SLOT_START, INV_SLOT_END, false)) { return nullptr; @@ -236,21 +259,14 @@ bool BrewingStandMenu::IngredientsSlot::mayPlace(shared_ptr item) { if (item != nullptr) { - if (PotionBrewing::SIMPLIFIED_BREWING) - { - Item* base = Item::items[item->id]; + Item* base = Item::items[item->id]; - if (FishFoodItem* fish = dynamic_cast(base)) - { + if (FishFoodItem* fish = dynamic_cast(base)) + { return item->getAuxValue() == 3; - } + } - return base->hasPotionBrewingFormula(); - } - else - { - return Item::items[item->id]->hasPotionBrewingFormula() || item->id == Item::netherwart_seeds_Id || item->id == Item::water_bucket_Id; - } + return base->hasPotionBrewingFormula(); } return false; } @@ -264,3 +280,22 @@ int BrewingStandMenu::IngredientsSlot::getMaxStackSize() const { return 64; } + +BrewingStandMenu::FuelSlot::FuelSlot(shared_ptr container, int slot, int x, int y) : Slot(container, slot, x, y) +{ +} + +bool BrewingStandMenu::FuelSlot::mayPlace(shared_ptr item) +{ + return item != nullptr && item->id == Item::blaze_powder_Id; +} + +bool BrewingStandMenu::FuelSlot::mayCombine(shared_ptr second) +{ + return false; +} + +int BrewingStandMenu::FuelSlot::getMaxStackSize() const +{ + return 64; +} diff --git a/Minecraft.World/BrewingStandMenu.h b/Minecraft.World/BrewingStandMenu.h index fded12d2..32271383 100644 --- a/Minecraft.World/BrewingStandMenu.h +++ b/Minecraft.World/BrewingStandMenu.h @@ -12,10 +12,11 @@ class BrewingStandMenu : public AbstractContainerMenu { // 4J Stu - Made public so that we can access these from the XUI menus public: + static const int FUEL_SLOT = 4; static const int INGREDIENT_SLOT = 3; static const int BOTTLE_SLOT_START = 0; static const int BOTTLE_SLOT_END = 2; - static const int INV_SLOT_START = INGREDIENT_SLOT + 1; + static const int INV_SLOT_START = FUEL_SLOT + 1; static const int INV_SLOT_END = INV_SLOT_START + 9 * 3; static const int USE_ROW_SLOT_START = INV_SLOT_END; static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9; @@ -23,6 +24,7 @@ public: private: shared_ptr brewingStand; Slot *ingredientSlot; + Slot *fuelSlot; public: BrewingStandMenu(shared_ptr inventory, shared_ptr brewingStand); @@ -31,7 +33,7 @@ private: int tc; public: - virtual void addSlotListener(ContainerListener *listener); + virtual void addSlotListener(ContainerListener* listener); virtual void broadcastChanges(); virtual void setData(int id, int value); virtual bool stillValid(shared_ptr player); @@ -62,4 +64,14 @@ private: virtual int getMaxStackSize() const; virtual bool mayCombine(shared_ptr item); // 4J Added }; + + class FuelSlot : public Slot + { + public: + FuelSlot(shared_ptr container, int slot, int x, int y); + + virtual bool mayPlace(shared_ptr item); + virtual int getMaxStackSize() const; + virtual bool mayCombine(shared_ptr); + }; }; \ No newline at end of file diff --git a/Minecraft.World/BrewingStandTileEntity.cpp b/Minecraft.World/BrewingStandTileEntity.cpp index 9515220e..aac8a92f 100644 --- a/Minecraft.World/BrewingStandTileEntity.cpp +++ b/Minecraft.World/BrewingStandTileEntity.cpp @@ -8,15 +8,18 @@ #include "net.minecraft.world.item.alchemy.h" int slotsForUp [] = { BrewingStandTileEntity::INGREDIENT_SLOT }; -int slotsForOtherFaces [] = { 0, 1, 2 }; +int slotsForOtherFaces[] = { 0, 1, 2, 4 }; intArray BrewingStandTileEntity::SLOTS_FOR_UP = intArray(slotsForUp, 1); -intArray BrewingStandTileEntity::SLOTS_FOR_OTHER_FACES = intArray(slotsForOtherFaces, 3); +intArray BrewingStandTileEntity::SLOTS_FOR_OTHER_FACES = intArray(slotsForOtherFaces, 4); BrewingStandTileEntity::BrewingStandTileEntity() { brewTime = 0; - items = ItemInstanceArray(4); + brewFuel = 0; + lastPotionCount = -1; + ingredientId = 0; + items = ItemInstanceArray(5); name = L""; } @@ -52,6 +55,13 @@ unsigned int BrewingStandTileEntity::getContainerSize() void BrewingStandTileEntity::tick() { + if (brewFuel <= 0 && items[FUEL_SLOT] != nullptr && items[FUEL_SLOT]->id == Item::blaze_powder_Id) { + brewFuel = 20; + items[FUEL_SLOT]->count--; + if (items[FUEL_SLOT]->count <= 0) items[FUEL_SLOT] = nullptr; + setChanged(); + } + if (brewTime > 0) { brewTime--; @@ -73,8 +83,10 @@ void BrewingStandTileEntity::tick() setChanged(); } } - else if (isBrewable()) + else if (isBrewable() && brewFuel > 0) { + brewFuel--; + setChanged(); brewTime = SharedConstants::TICKS_PER_SECOND * PotionBrewing::BREWING_TIME_SECONDS; ingredientId = items[INGREDIENT_SLOT]->id; } @@ -94,6 +106,11 @@ int BrewingStandTileEntity::getBrewTime() return brewTime; } +int BrewingStandTileEntity::getBrewFuel() +{ + return brewFuel; +} + bool BrewingStandTileEntity::isBrewable() { if (items[INGREDIENT_SLOT] == nullptr || items[INGREDIENT_SLOT]->count <= 0) @@ -335,6 +352,7 @@ void BrewingStandTileEntity::load(CompoundTag *base) } brewTime = base->getShort(L"BrewTime"); + if (base->contains(L"BrewFuel")) brewFuel = base->getShort(L"BrewFuel"); if (base->contains(L"CustomName")) name = base->getString(L"CustomName"); } @@ -343,6 +361,7 @@ void BrewingStandTileEntity::save(CompoundTag *base) TileEntity::save(base); base->putShort(L"BrewTime", static_cast(brewTime)); + base->putShort(L"BrewFuel", static_cast(brewFuel)); ListTag *listTag = new ListTag(); for (int i = 0; i < items.length; i++) @@ -440,6 +459,7 @@ void BrewingStandTileEntity::stopOpen() bool BrewingStandTileEntity::canPlaceItem(int slot, shared_ptr item) { + if (slot == FUEL_SLOT) return item->id == Item::blaze_powder_Id; if (slot == INGREDIENT_SLOT) { if (PotionBrewing::SIMPLIFIED_BREWING) @@ -460,6 +480,11 @@ void BrewingStandTileEntity::setBrewTime(int value) brewTime = value; } +void BrewingStandTileEntity::setBrewFuel(int value) +{ + brewFuel = value; +} + int BrewingStandTileEntity::getPotionBits() { int newCount = 0; @@ -500,6 +525,7 @@ shared_ptr BrewingStandTileEntity::clone() TileEntity::clone(result); result->brewTime = brewTime; + result->brewFuel = brewFuel; result->lastPotionCount = lastPotionCount; result->ingredientId = ingredientId; diff --git a/Minecraft.World/BrewingStandTileEntity.h b/Minecraft.World/BrewingStandTileEntity.h index c848767e..247eb8b4 100644 --- a/Minecraft.World/BrewingStandTileEntity.h +++ b/Minecraft.World/BrewingStandTileEntity.h @@ -9,6 +9,7 @@ public: static TileEntity *create() { return new BrewingStandTileEntity(); } static const int INGREDIENT_SLOT = 3; + static const int FUEL_SLOT = 4; private: ItemInstanceArray items; @@ -16,6 +17,7 @@ private: static intArray SLOTS_FOR_OTHER_FACES; int brewTime; + short brewFuel; int lastPotionCount; int ingredientId; wstring name; @@ -31,6 +33,7 @@ public: virtual void tick(); int getBrewTime(); + int getBrewFuel(); private: bool isBrewable(); @@ -51,6 +54,7 @@ public: virtual void stopOpen(); virtual bool canPlaceItem(int slot, shared_ptr item); virtual void setBrewTime(int value); + virtual void setBrewFuel(int value); virtual void setChanged() { TileEntity::setChanged(); } // 4J added int getPotionBits(); virtual intArray getSlotsForFace(int face);