Files
LegacyRenouveau/Minecraft.World/Bush.h
T
Anaël d8d65bcd49 game loop: Refactor the tooltips loop
Moved the whole logic to a new file (TooltipManager.cpp), and rewrote most of the logic to profit from object oriented programming. The side-effect is that the changes are scattered across entities, tiles and items because moving everything to OOP requires to add the tooltip to every .cpp file for every tile/item/entities (or their class, on plants for example which all use the tooltip IDS_TOOLTIPS_PLANT)

The issue with the default tooltips loop written by 4J is that:

    Its running in the main Minecraft::tick loop and is more than a thousand lines long, polluting the function.
    Not using C++'s full potential with object oriented programming, 4J decided to use a big switch case (probably because it could run better on hardware without branch prediction like the WiiU or Xbox 360 ?)
    And seems to be better off in its own file than in the main Minecraft.cpp file
2026-10-04 20:54:24 +02:00

45 lines
1.1 KiB
C++

#pragma once
#include "Tile.h"
#include "Material.h"
#include "Definitions.h"
class Random;
class Level;
class Bush : public Tile
{
friend class Tile;
private:
void _init();
protected:
Bush(int id, Material *material);
Bush(int id);
public:
virtual void updateDefaultShape();
virtual bool mayPlace(Level *level, int x, int y, int z);
protected:
virtual bool mayPlaceOn(int tile);
public:
virtual void neighborChanged(Level *level, int x, int y, int z, int type);
virtual void tick(Level *level, int x, int y, int z, Random *random);
protected:
void checkAlive(Level *level, int x, int y, int z);
public:
virtual bool canSurvive(Level *level, int x, int y, int z);
virtual AABB *getAABB(Level *level, int x, int y, int z);
virtual bool blocksLight();
virtual bool isSolidRender(bool isServerLevel = false);
virtual bool isCubeShaped();
virtual int getRenderShape();
virtual int getUseTooltipId(std::shared_ptr<ItemInstance> itemInstance, std::shared_ptr<Player> player, Level* level, int x, int y, int z, bool bUseItem) const;
};