mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-06-07 18:43:44 +00:00
TU24
This commit is contained in:
@@ -9,26 +9,19 @@
|
||||
#include "..\Minecraft.Client\Options.h"
|
||||
#include "..\Minecraft.Client\Minecraft.h"
|
||||
|
||||
const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = {
|
||||
IDS_TILE_LEAVES_OAK,
|
||||
const unsigned int LeafTile::LEAF_NAMES[LEAF_NAMES_LENGTH] = { IDS_TILE_LEAVES_OAK,
|
||||
IDS_TILE_LEAVES_SPRUCE,
|
||||
IDS_TILE_LEAVES_BIRCH,
|
||||
IDS_TILE_LEAVES_JUNGLE,
|
||||
IDS_TILE_LEAVES_ACACIA,
|
||||
IDS_TILE_LEAVES_DARK_OAK,
|
||||
};
|
||||
|
||||
const wstring LeafTile::TEXTURES[2][6] = {
|
||||
{L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle", L"leaves_acacia", L"leaves_big_oak"},
|
||||
{L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque", L"leaves_acacia_fast", L"leaves_big_oak_fast"},
|
||||
};
|
||||
const wstring LeafTile::TEXTURES[2][4] = { {L"leaves", L"leaves_spruce", L"leaves", L"leaves_jungle"}, {L"leaves_opaque", L"leaves_spruce_opaque", L"leaves_opaque", L"leaves_jungle_opaque"},};
|
||||
|
||||
LeafTile::LeafTile(int id, int offset) : TransparentTile(id, Material::leaves, false, isSolidRender())
|
||||
LeafTile::LeafTile(int id) : TransparentTile(id, Material::leaves, false, isSolidRender())
|
||||
{
|
||||
checkBuffer = nullptr;
|
||||
fancyTextureSet = 0;
|
||||
setTicking(true);
|
||||
leafTypeOffset = offset;
|
||||
}
|
||||
|
||||
LeafTile::~LeafTile()
|
||||
@@ -49,11 +42,11 @@ int LeafTile::getColor() const
|
||||
|
||||
int LeafTile::getColor(int data)
|
||||
{
|
||||
if ((data & LEAF_TYPE_MASK) + leafTypeOffset == EVERGREEN_LEAF)
|
||||
if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF)
|
||||
{
|
||||
return FoliageColor::getEvergreenColor();
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) + leafTypeOffset == BIRCH_LEAF)
|
||||
if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF)
|
||||
{
|
||||
return FoliageColor::getBirchColor();
|
||||
}
|
||||
@@ -69,11 +62,11 @@ int LeafTile::getColor(LevelSource *level, int x, int y, int z)
|
||||
// 4J - changed interface to have data passed in, and put existing interface as wrapper above
|
||||
int LeafTile::getColor(LevelSource *level, int x, int y, int z, int data)
|
||||
{
|
||||
if ((data & LEAF_TYPE_MASK) + leafTypeOffset == EVERGREEN_LEAF)
|
||||
if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF)
|
||||
{
|
||||
return FoliageColor::getEvergreenColor();
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) + leafTypeOffset == BIRCH_LEAF)
|
||||
if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF)
|
||||
{
|
||||
return FoliageColor::getBirchColor();
|
||||
}
|
||||
@@ -262,7 +255,7 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
int chance = 20;
|
||||
if ((data & LEAF_TYPE_MASK) + leafTypeOffset == JUNGLE_LEAF)
|
||||
if ((data & LEAF_TYPE_MASK) == JUNGLE_LEAF)
|
||||
{
|
||||
chance = 40;
|
||||
}
|
||||
@@ -289,7 +282,7 @@ void LeafTile::spawnResources(Level *level, int x, int y, int z, int data, float
|
||||
chance = 40;
|
||||
}
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) + leafTypeOffset == NORMAL_LEAF && level->random->nextInt(chance) == 0)
|
||||
if ((data & LEAF_TYPE_MASK) == NORMAL_LEAF && level->random->nextInt(chance) == 0)
|
||||
{
|
||||
popResource(level, x, y, z, std::make_shared<ItemInstance>(Item::apple_Id, 1, 0));
|
||||
}
|
||||
@@ -306,7 +299,7 @@ void LeafTile::playerDestroy(Level *level, shared_ptr<Player> player, int x, int
|
||||
);
|
||||
|
||||
// drop leaf block instead of sapling
|
||||
popResource(level, x, y, z, std::make_shared<ItemInstance>(Tile::leaves_Id, 1, (data & LEAF_TYPE_MASK) + leafTypeOffset));
|
||||
popResource(level, x, y, z, std::make_shared<ItemInstance>(Tile::leaves_Id, 1, data & LEAF_TYPE_MASK));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -316,7 +309,7 @@ void LeafTile::playerDestroy(Level *level, shared_ptr<Player> player, int x, int
|
||||
|
||||
int LeafTile::getSpawnResourcesAuxValue(int data)
|
||||
{
|
||||
return (data & LEAF_TYPE_MASK) + leafTypeOffset;
|
||||
return data & LEAF_TYPE_MASK;
|
||||
}
|
||||
|
||||
bool LeafTile::isSolidRender(bool isServerLevel)
|
||||
@@ -329,7 +322,19 @@ bool LeafTile::isSolidRender(bool isServerLevel)
|
||||
|
||||
Icon *LeafTile::getTexture(int face, int data)
|
||||
{
|
||||
return icons[fancyTextureSet][leafTypeOffset + (data & LEAF_TYPE_MASK)];
|
||||
if ((data & LEAF_TYPE_MASK) == EVERGREEN_LEAF)
|
||||
{
|
||||
return icons[fancyTextureSet][EVERGREEN_LEAF];
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) == JUNGLE_LEAF)
|
||||
{
|
||||
return icons[fancyTextureSet][JUNGLE_LEAF];
|
||||
}
|
||||
if ((data & LEAF_TYPE_MASK) == BIRCH_LEAF)
|
||||
{
|
||||
return icons[fancyTextureSet][BIRCH_LEAF];
|
||||
}
|
||||
return icons[fancyTextureSet][0];
|
||||
}
|
||||
|
||||
void LeafTile::setFancy(bool fancyGraphics)
|
||||
@@ -340,7 +345,7 @@ void LeafTile::setFancy(bool fancyGraphics)
|
||||
|
||||
shared_ptr<ItemInstance> LeafTile::getSilkTouchItemInstance(int data)
|
||||
{
|
||||
return std::make_shared<ItemInstance>(id, 1, (data & LEAF_TYPE_MASK) + leafTypeOffset);
|
||||
return std::make_shared<ItemInstance>(id, 1, data & LEAF_TYPE_MASK);
|
||||
}
|
||||
|
||||
void LeafTile::stepOn(Level *level, int x, int y, int z, shared_ptr<Entity> entity)
|
||||
@@ -356,12 +361,8 @@ bool LeafTile::shouldTileTick(Level *level, int x,int y,int z)
|
||||
|
||||
unsigned int LeafTile::getDescriptionId(int iData /*= -1*/)
|
||||
{
|
||||
int leafIndex = 0;
|
||||
if (iData != -1)
|
||||
{
|
||||
leafIndex = (iData & LEAF_TYPE_MASK) + leafTypeOffset;
|
||||
}
|
||||
return LeafTile::LEAF_NAMES[leafIndex];
|
||||
int leafIndex = iData & LEAF_TYPE_MASK;
|
||||
return LeafTile::LEAF_NAMES[leafIndex];
|
||||
}
|
||||
|
||||
void LeafTile::registerIcons(IconRegister *iconRegister)
|
||||
@@ -370,7 +371,7 @@ void LeafTile::registerIcons(IconRegister *iconRegister)
|
||||
{
|
||||
//icons[fancy] = new Icon[TEXTURES[fancy].length];
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
icons[fancy][i] = iconRegister->registerIcon(TEXTURES[fancy][i]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user