Skip to content

Commit

Permalink
* Fix render bug with repeaters, add repeater item
Browse files Browse the repository at this point in the history
  • Loading branch information
iProgramMC committed Apr 8, 2024
1 parent 711461d commit 855def5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion platforms/windows/projects/World/World.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
<ClInclude Include="$(MC_ROOT)\source\world\entity\Creeper.hpp" />
<ClInclude Include="$(MC_ROOT)\source\world\entity\Pig.hpp" />
<ClInclude Include="$(MC_ROOT)\source\world\entity\Rocket.hpp" />
<ClInclude Include="..\..\..\..\source\world\item\RedstoneItem.hpp" />
<ClInclude Include="..\..\..\..\source\world\item\RepeaterItem.hpp" />
<ClInclude Include="..\..\..\..\source\world\tile\ButtonTile.hpp" />
<ClInclude Include="..\..\..\..\source\world\tile\DiodeTile.hpp" />
<ClInclude Include="..\..\..\..\source\world\tile\LeverTile.hpp" />
Expand Down
6 changes: 3 additions & 3 deletions platforms/windows/projects/World/World.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -826,11 +826,11 @@
<ClInclude Include="..\..\..\..\source\world\tile\ButtonTile.hpp">
<Filter>Header Files\Tile</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\source\world\item\RedstoneItem.hpp">
<Filter>Header Files\Item</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\source\world\tile\DiodeTile.hpp">
<Filter>Header Files\Tile</Filter>
</ClInclude>
<ClInclude Include="..\..\..\..\source\world\item\RepeaterItem.hpp">
<Filter>Header Files\Item</Filter>
</ClInclude>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions source/client/renderer/TileRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1666,8 +1666,8 @@ bool TileRenderer::tesselateDiodeInWorld(Tile* tile, int x, int y, int z)
case 3:
v4x = v1x = float(x + 0);
v3x = v2x = float(x + 1);
v4z = v3z = float(x + 0);
v2z = v1z = float(x + 1);
v4z = v3z = float(z + 0);
v2z = v1z = float(z + 1);
break;
case 1:
v4x = v1x = float(x + 1);
Expand Down
3 changes: 1 addition & 2 deletions source/world/item/Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ void Inventory::prepareCreativeInventory()
addCreativeItem(Tile::button->m_ID);
addCreativeItem(Tile::plate_stone->m_ID);
addCreativeItem(Tile::plate_wood->m_ID);
addCreativeItem(Tile::repeater_off->m_ID);
addCreativeItem(Tile::repeater_on->m_ID);
addCreativeItem(Item::diode->m_itemID);

for (int i = 0; i < C_MAX_HOTBAR_ITEMS; i++)
m_hotbar[i] = i;
Expand Down
8 changes: 7 additions & 1 deletion source/world/item/Item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "RocketItem.hpp"
#include "RedstoneItem.hpp"

#include "world/tile/Tile.hpp"

#define ITEM(x) ((x) - 256)

#define NEW_ITEM(id) (new Item(ITEM(id)))
Expand Down Expand Up @@ -159,7 +161,7 @@ void Item::initItems()
->setIcon(9, 3)
->setDescriptionId("clay");

Item::reeds = NEW_X_ITEM(TilePlanterItem, ITEM_REEDS, TILE_REEDS)
Item::reeds = NEW_X_ITEM(TilePlanterItem, ITEM_REEDS, Tile::reeds->m_ID)
->setIcon(11, 1)
->setDescriptionId("reeds");

Expand Down Expand Up @@ -204,6 +206,10 @@ void Item::initItems()
Item::redStone = NEW_X_ITEMN(RedstoneItem, ITEM_REDSTONE)
->setIcon(8, 3)
->setDescriptionId("redstone");

Item::diode = NEW_X_ITEM(TilePlanterItem, ITEM_DIODE, Tile::repeater_off->m_ID) // Yeah, I found that weird too.
->setIcon(6, 5)
->setDescriptionId("diode");
}

int Item::getIcon(ItemInstance* pInstance)
Expand Down
7 changes: 0 additions & 7 deletions source/world/tile/DiodeTile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,6 @@ bool DiodeTile::isSolidRender()

int DiodeTile::getResource(int data, Random* random)
{
// TODO: Remove once done
#ifndef _DEBUG
#error bruh
#endif
if (!Item::diode)
return 0;

return Item::diode->m_itemID;
}

Expand Down

0 comments on commit 855def5

Please sign in to comment.