mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-26 21:26:38 +01:00
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
195 lines
5.2 KiB
C++
195 lines
5.2 KiB
C++
#include "stdafx.h"
|
|
#include "net.minecraft.world.level.h"
|
|
#include "net.minecraft.world.item.h"
|
|
#include "net.minecraft.world.entity.player.h"
|
|
#include "Material.h"
|
|
#include "ItemInstance.h"
|
|
#include "Random.h"
|
|
#include "com.mojang.nbt.h"
|
|
#include "BannerTileEntity.h"
|
|
#include "BannerTile.h"
|
|
|
|
BannerTile::BannerTile(int id, bool onGround) : BaseEntityTile(id, Material::wood, isSolidRender())
|
|
{
|
|
this->onGround = onGround;
|
|
this->m_dropColor = 15;
|
|
updateDefaultShape();
|
|
}
|
|
|
|
Icon *BannerTile::getTexture(int face, int data)
|
|
{
|
|
return Tile::wood->getTexture(face);
|
|
}
|
|
|
|
void BannerTile::updateDefaultShape()
|
|
{
|
|
if (onGround)
|
|
{
|
|
float r = 4 / 16.0f;
|
|
float h = 16 / 16.0f;
|
|
this->setShape(0.5f - r, 0, 0.5f - r, 0.5f + r, h, 0.5f + r);
|
|
}
|
|
else
|
|
{
|
|
this->setShape(0, 0, 0, 1, 1, 1);
|
|
}
|
|
}
|
|
|
|
AABB *BannerTile::getAABB(Level *level, int x, int y, int z)
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
AABB *BannerTile::getTileAABB(Level *level, int x, int y, int z)
|
|
{
|
|
updateShape(level, x, y, z);
|
|
return BaseEntityTile::getTileAABB(level, x, y, z);
|
|
}
|
|
|
|
void BannerTile::updateShape(LevelSource *level, int x, int y, int z, int forceData, shared_ptr<TileEntity> forceEntity)
|
|
{
|
|
shared_ptr<BannerTileEntity> bte = forceEntity
|
|
? dynamic_pointer_cast<BannerTileEntity>(forceEntity)
|
|
: dynamic_pointer_cast<BannerTileEntity>(level->getTileEntity(x, y, z));
|
|
if (!bte || !bte->isWall())
|
|
{
|
|
setShape(0.25f, 0, 0.25f, 0.75f, 1, 0.75f);
|
|
return;
|
|
}
|
|
|
|
int face = level->getData(x, y, z);
|
|
|
|
float h0 = 0 / 16.0f;
|
|
float h1 = 12.5f / 16.0f;
|
|
float d0 = 2 / 16.0f;
|
|
float w0 = 0 / 16.0f;
|
|
float w1 = 16 / 16.0f;
|
|
|
|
setShape(0, 0, 0, 1, 1, 1);
|
|
if (face == 2) setShape(w0, h0, 1 - d0, w1, h1, 1);
|
|
if (face == 3) setShape(w0, h0, 0, w1, h1, d0);
|
|
if (face == 4) setShape(1 - d0, h0, w0, 1, h1, w1);
|
|
if (face == 5) setShape(0, h0, w0, d0, h1, w1);
|
|
}
|
|
|
|
int BannerTile::getRenderShape()
|
|
{
|
|
return Tile::SHAPE_INVISIBLE;
|
|
}
|
|
|
|
bool BannerTile::isCubeShaped()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool BannerTile::isPathfindable(LevelSource *level, int x, int y, int z)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
bool BannerTile::isSolidRender(bool isServerLevel)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
shared_ptr<TileEntity> BannerTile::newTileEntity(Level *level)
|
|
{
|
|
return std::make_shared<BannerTileEntity>();
|
|
}
|
|
|
|
int BannerTile::getResource(int data, Random *random, int playerBonusLevel)
|
|
{
|
|
return Tile::standing_banner_Id;
|
|
}
|
|
|
|
void BannerTile::neighborChanged(Level *level, int x, int y, int z, int type)
|
|
{
|
|
shared_ptr<BannerTileEntity> bte = dynamic_pointer_cast<BannerTileEntity>(level->getTileEntity(x, y, z));
|
|
bool isWall = bte && bte->isWall();
|
|
bool remove = false;
|
|
|
|
if (!isWall)
|
|
{
|
|
if (!level->getMaterial(x, y - 1, z)->isSolid()) remove = true;
|
|
}
|
|
else
|
|
{
|
|
int face = level->getData(x, y, z);
|
|
remove = true;
|
|
if (face == 2 && level->getMaterial(x, y, z + 1)->isSolid()) remove = false;
|
|
if (face == 3 && level->getMaterial(x, y, z - 1)->isSolid()) remove = false;
|
|
if (face == 4 && level->getMaterial(x + 1, y, z)->isSolid()) remove = false;
|
|
if (face == 5 && level->getMaterial(x - 1, y, z)->isSolid()) remove = false;
|
|
}
|
|
if (remove)
|
|
{
|
|
spawnResources(level, x, y, z, level->getData(x, y, z), 0);
|
|
level->removeTile(x, y, z);
|
|
level->removeTileEntity(x, y, z);
|
|
}
|
|
|
|
BaseEntityTile::neighborChanged(level, x, y, z, type);
|
|
}
|
|
|
|
int BannerTile::cloneTileId(Level *level, int x, int y, int z)
|
|
{
|
|
return Tile::standing_banner_Id;
|
|
}
|
|
|
|
void BannerTile::registerIcons(IconRegister *iconRegister)
|
|
{
|
|
}
|
|
|
|
void BannerTile::playerWillDestroy(Level *level, int x, int y, int z, int data, shared_ptr<Player> player)
|
|
{
|
|
shared_ptr<BannerTileEntity> bte = dynamic_pointer_cast<BannerTileEntity>(level->getTileEntity(x, y, z));
|
|
m_dropColor = (bte != nullptr) ? (15 - (bte->getBaseColor() & 15)) : 0;
|
|
m_dropPatterns.clear();
|
|
if (bte != nullptr)
|
|
{
|
|
for (const BannerPattern &bp : bte->getPatterns()) m_dropPatterns.push_back(make_pair(bp.pattern, bp.color));
|
|
}
|
|
|
|
BaseEntityTile::playerWillDestroy(level, x, y, z, data, player);
|
|
}
|
|
|
|
void BannerTile::spawnResources(Level *level, int x, int y, int z, int data, float odds, int playerBonusLevel)
|
|
{
|
|
if (level->isClientSide) return;
|
|
|
|
int color = m_dropColor;
|
|
vector<pair<wstring, int> > patterns = m_dropPatterns;
|
|
shared_ptr<BannerTileEntity> bte = dynamic_pointer_cast<BannerTileEntity>(level->getTileEntity(x, y, z));
|
|
if (bte != nullptr)
|
|
{
|
|
color = 15 - (bte->getBaseColor() & 15);
|
|
patterns.clear();
|
|
for (const BannerPattern &bp : bte->getPatterns()) patterns.push_back(make_pair(bp.pattern, bp.color));
|
|
}
|
|
m_dropPatterns.clear();
|
|
|
|
int count = getResourceCountForLootBonus(playerBonusLevel, level->random);
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
if (level->random->nextFloat() > odds) continue;
|
|
shared_ptr<ItemInstance> drop = std::make_shared<ItemInstance>(Tile::standing_banner_Id, 1, color);
|
|
if (!patterns.empty())
|
|
{
|
|
CompoundTag *tag = new CompoundTag();
|
|
CompoundTag *bet = new CompoundTag();
|
|
ListTag<CompoundTag> *list = new ListTag<CompoundTag>();
|
|
for (const pair<wstring, int> &p : patterns)
|
|
{
|
|
CompoundTag *entry = new CompoundTag();
|
|
entry->putString(L"Pattern", p.first);
|
|
entry->putInt(L"Color", p.second);
|
|
list->add(entry);
|
|
}
|
|
bet->put(L"Patterns", list);
|
|
tag->putCompound(L"BlockEntityTag", bet);
|
|
drop->setTag(tag);
|
|
}
|
|
popResource(level, x, y, z, drop);
|
|
}
|
|
}
|