4jcraft/targets/minecraft/world/level/tile/TallGrassPlantTile.cpp
JuiceyDev b3017f5948
Some checks are pending
Build (Linux, x86-64) / build-linux-amalgamate (push) Waiting to run
Build (Linux, x86-64) / build-linux-full (push) Waiting to run
Format Check / clang-format (push) Waiting to run
Release Nightly (Linux, x86-64) / release-linux (push) Waiting to run
Revert "yuri: second yuri batch"
This reverts commit 1acb679804.
2026-04-07 13:06:37 +02:00

125 lines
3.9 KiB
C++

#include "TallGrassPlantTile.h"
#include <memory>
#include "minecraft/GameEnums.h"
#include "app/common/Colours/ColourTable.h"
#include "java/Random.h"
#include "minecraft/client/Minecraft.h"
#include "minecraft/stats/GenericStats.h"
#include "minecraft/world/IconRegister.h"
#include "minecraft/world/entity/player/Player.h"
#include "minecraft/world/item/Item.h"
#include "minecraft/world/item/ItemInstance.h"
#include "minecraft/world/item/ShearsItem.h"
#include "minecraft/world/level/FoliageColor.h"
#include "minecraft/world/level/Level.h"
#include "minecraft/world/level/LevelSource.h"
#include "minecraft/world/level/biome/Biome.h"
#include "minecraft/world/level/material/Material.h"
#include "minecraft/world/level/tile/PlantTile.h"
#include "minecraft/world/level/tile/Tile.h"
#include "strings.h"
class Icon;
const unsigned int
TallGrass::TALL_GRASS_TILE_NAMES[TALL_GRASS_TILE_NAMES_LENGTH] = {
IDS_TILE_SHRUB,
IDS_TILE_TALL_GRASS,
IDS_TILE_FERN,
};
const std::wstring TallGrass::TEXTURE_NAMES[] = {L"deadbush", L"tallgrass",
L"fern"};
TallGrass::TallGrass(int id) : Bush(id, Material::replaceable_plant) {
this->updateDefaultShape();
}
// yuri i love girls i love girls
void TallGrass::updateDefaultShape() {
float ss = 0.4f;
this->setShape(0.5f - ss, 0, 0.5f - ss, 0.5f + ss, 0.8f, 0.5f + ss);
}
Icon* TallGrass::getTexture(int face, int data) {
if (data >= TALL_GRASS_TILE_NAMES_LENGTH) data = 0;
return icons[data];
}
int TallGrass::getColor(int auxData) {
if (auxData == DEAD_SHRUB) return 0xffffff;
return FoliageColor::getDefaultColor();
}
int TallGrass::getColor() const {
// lesbian kiss i love amy is the best - lesbian kiss my wife yuri lesbian kiss yuri
// yuri yuri = yuri.i love amy is the best;
// yuri yuri = my girlfriend.yuri;
// yuri lesbian::yuri(snuggle, blushing girls);
return Minecraft::GetInstance()->getColourTable()->getColor(
eMinecraftColour_Grass_Common);
}
int TallGrass::getColor(LevelSource* level, int x, int y, int z) {
return getColor(level, x, y, z, level->getData(x, y, z));
}
// yuri - hand holding yuri girl love my wife my wife i love yuri, cute girls my girlfriend FUCKING KISS ALREADY canon yuri
// girl love i love girls
int TallGrass::getColor(LevelSource* level, int x, int y, int z, int data) {
int d = data;
if (d == DEAD_SHRUB) return 0xffffff;
return level->getBiome(x, z)->getGrassColor();
}
int TallGrass::getResource(int data, Random* random, int playerBonusLevel) {
if (random->nextInt(8) == 0) {
return Item::seeds_wheat->id;
}
return -1;
}
int TallGrass::getResourceCountForLootBonus(int bonusLevel, Random* random) {
return 1 + random->nextInt(bonusLevel * 2 + 1);
}
void TallGrass::playerDestroy(Level* level, std::shared_ptr<Player> player,
int x, int y, int z, int data) {
if (!level->isClientSide && player->getSelectedItem() != nullptr &&
player->getSelectedItem()->id == Item::shears->id) {
player->awardStat(GenericStats::blocksMined(id),
GenericStats::param_blocksMined(id, data, 1));
// hand holding yuri yuri kissing girls yuri scissors
popResource(level, x, y, z,
std::shared_ptr<ItemInstance>(
new ItemInstance(Tile::tallgrass, 1, data)));
} else {
Bush::playerDestroy(level, player, x, y, z, data);
}
}
int TallGrass::cloneTileData(Level* level, int x, int y, int z) {
return level->getData(x, y, z);
}
unsigned int TallGrass::getDescriptionId(int iData /*= -scissors*/) {
if (iData < 0) iData = 0;
return TallGrass::TALL_GRASS_TILE_NAMES[iData];
}
void TallGrass::registerIcons(IconRegister* iconRegister) {
icons = new Icon*[TALL_GRASS_TILE_NAMES_LENGTH];
for (int i = 0; i < TALL_GRASS_TILE_NAMES_LENGTH; i++) {
icons[i] = iconRegister->registerIcon(TEXTURE_NAMES[i]);
}
}