Files
neoLegacy/Minecraft.World/LeafTile2.cpp
T
Tranqlmao 9abd52985e TU53 + Bug Fixes (Many)
Patch Notes:
Blocks
+ Colored shulker boxes
+ Concrete powder
+ Concrete
+ Glazed terracotta
Items
+ Shulker shell
+ Iron nugget
UI Changes
+ Added Custom Controls to Keyboard & Mouse, as well as Controller
+ Added Custom SuperFlat
+ Added Edit Server Menu
+ Added Firework Crafting
Feature Changes
+ Host Options
+ Added Pick Block
+ Added off-hand slot for maps and arrows.
Bug Fixes & changes
+ TU47: Banner hitbox wrong (and inventory model fixed)
+ TU47/48: Ice not melting properly
+ TU48: Dead bushes not dropping sticks
+ TU48: Guardians and polar bears not dropping cooked fish when on fire
+ TU48: Bonus chest missing saplings and seeds
+ TU48: Frosted ice obtainable
+ TU48: Hoppers not collecting items
+ TU48: Wither skeletons spawning in 2-high gaps
+ TU48: End crystals exploding with “TNT Explodes” off
+ TU48: Tamed ocelots staying hostile
+ TU48: Signs not placing on tall grass
+ TU51: Skeleton hitbox wrong
+ TU53: Fall damage in shallow water
+ TU53: Squids not spawning in man-made pools
+ Elytra has been improved to be more accurate to the source material
+ Removed Spectral Arrow from crafting
+ Fixed several broken item descriptions
+ You can no longer cook Pufferfish or Clownfish
+ Fixed scaling issue with paperdoll and chat
+ Iron and gold armor can now be smelted into nuggets.
+ More items can now be used as fuel in a furnace.
+ Using a firework rocket while gliding with elytra will now give the player a boost.
+ Changed the color of dyes, wool, carpets, and banners.
+ Reordered all colored blocks and items in the Creative inventory. Banners now have the same order of colors as all other colored blocks and items.
+ Fishing rods can now hook on entities without causing knockback or pseudo-damage.
+ Fixed banner crafting
+ Fixed Map colors for certain blocks
+ Fixed Path block height
+ Fixed String block issues
+ Fixed Item frame culling.
+ Fixed Tutorial world NBT/Block State issues
+ Fixed World Slider
+ Fixed Enderman AI
+ Fixed Player animation bug
+ HUD Flash text changes
+ Generation accuracy changes
+ Many other small accuracy changes and fixes
2026-11-24 13:44:06 -05:00

137 lines
3.6 KiB
C++

#include "stdafx.h"
#include "LeafTile2.h"
#include "net.minecraft.world.level.tile.h"
#include "net.minecraft.world.level.h"
#include "net.minecraft.world.item.h"
#include "net.minecraft.world.entity.player.h"
#include "net.minecraft.stats.h"
#include "net.minecraft.world.level.biome.h"
#include "FoliageColor.h"
#include "IconRegister.h"
const unsigned int LeafTile2::LEAF2_NAMES[LEAF2_NAMES_SIZE] = {
IDS_TILE_LEAVES_ACACIA,
IDS_TILE_LEAVES_DARK_OAK
};
const wstring LeafTile2::TEXTURES[2][2] = {
{ L"leaves_acacia", L"leaves_dark_oak" }, // index 0: Fancy
{ L"leaves_acacia_opaque", L"leaves_dark_oak_opaque" } // index 1: Fast
};
LeafTile2::LeafTile2(int id) : LeafTile(id)
{
// do nothing here
}
Icon *LeafTile2::getTexture(int face, int data)
{
int type = data & 3;
if (type >= LEAF2_NAMES_SIZE) type = 0;
// isSolidRender() in LeafTile returns 'true' if graphics is Fast
// if true -> index is 1, else 0.
int textureSet = getFancyTextureSet();
return icons[textureSet][type];
}
unsigned int LeafTile2::getDescriptionId(int iData)
{
int type = iData & 3;
if (type < 0 || type >= LEAF2_NAMES_SIZE) type = 0;
return LeafTile2::LEAF2_NAMES[type];
}
void LeafTile2::registerIcons(IconRegister *iconRegister)
{
for (int fancy = 0; fancy < 2; fancy++)
{
for (int i = 0; i < 2; i++)
{
icons[fancy][i] = iconRegister->registerIcon(TEXTURES[fancy][i]);
}
}
}
int LeafTile2::getColor(int data)
{
// in the inventory use the default colour for leaves
return FoliageColor::getDefaultColor();
}
int LeafTile2::getColor(LevelSource *level, int x, int y, int z, int data)
{
// Codice di blending per il colore del bioma (copiato dal tuo LeafTile.cpp))
// blending biome colors copied from LeafTile.cpp
int totalRed = 0;
int totalGreen = 0;
int totalBlue = 0;
for (int oz = -1; oz <= 1; oz++)
{
for (int ox = -1; ox <= 1; ox++)
{
int foliageColor = level->getBiome(x + ox, z + oz)->getFolageColor(); // they mispelled the word. getFolageColor without "i"
totalRed += (foliageColor & 0xff0000) >> 16;
totalGreen += (foliageColor & 0xff00) >> 8;
totalBlue += (foliageColor & 0xff);
}
}
return (((totalRed / 9) & 0xFF) << 16) | (((totalGreen / 9) & 0xFF) << 8) | (((totalBlue / 9) & 0xFF));
}
void LeafTile2::playerDestroy(Level *level, shared_ptr<Player> player, int x, int y, int z, int data)
{
// if player is using shears, drop "leaves2" (ID 161) , instead of "leaves" (ID 18)
if (!level->isClientSide && player->getSelectedItem() != nullptr && player->getSelectedItem()->id == Item::shears->id)
{
player->awardStat(
GenericStats::blocksMined(id),
GenericStats::param_blocksMined(id, data, 1)
);
popResource(level, x, y, z, std::make_shared<ItemInstance>(Tile::leaves2_Id, 1, data & 3));
}
else
{
// or default destroy
TransparentTile::playerDestroy(level, player, x, y, z, data);
}
}
void LeafTile2::spawnResources(Level* level, int x, int y, int z, int data, float odds, int playerBonusLevel) {
if (!level->isClientSide)
{
int chance = 20;
if (playerBonusLevel > 0)
{
chance -= 2 << playerBonusLevel;
if (chance < 10) chance = 10;
}
if (level->random->nextInt(chance) == 0)
{
popResource(level, x, y, z, std::make_shared<ItemInstance>(Tile::sapling_Id, 1, (data & 3) + 4));
}
if ((data & 3) == 1)
{
int appleChance = 200;
if (playerBonusLevel > 0)
{
appleChance -= 10 << playerBonusLevel;
if (appleChance < 40) appleChance = 40;
}
if (level->random->nextInt(appleChance) == 0)
{
popResource(level, x, y, z, std::make_shared<ItemInstance>(Item::apple_Id, 1, 0));
}
}
}
}