feat: new chunk load toggle

also fixes item frames / paintings in dlc worlds
This commit is contained in:
Fireblade
2026-07-24 15:14:27 -04:00
parent 261700ea8b
commit 306d1c9fb7
10 changed files with 50 additions and 6 deletions
+5 -2
View File
@@ -577,12 +577,14 @@ void ClientConnection::handleAddEntity(shared_ptr<AddEntityPacket> packet)
{
int dir = packet->data & 0xFF;
bool placedByPlayer = (packet->data & 0x100) != 0;
bool placedByTutorial = (packet->data & 0x200) != 0;
e = std::make_shared<ItemFrame>(level, (int)x, (int)y, (int)z, dir);
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
if (frame != nullptr)
{
frame->placedByPlayer = placedByPlayer;
if (placedByPlayer)
frame->placedByTutorial = placedByTutorial;
if (placedByPlayer || placedByTutorial)
{
frame->setDir(dir);
}
@@ -842,7 +844,8 @@ void ClientConnection::handleAddPainting(shared_ptr<AddPaintingPacket> packet)
{
shared_ptr<Painting> painting = std::make_shared<Painting>(level, packet->x, packet->y, packet->z, packet->dir, packet->motive);
painting->placedByPlayer = packet->placedByPlayer;
if (packet->placedByPlayer)
painting->placedByTutorial = packet->placedByTutorial;
if (packet->placedByPlayer || packet->placedByTutorial)
{
painting->setDir(packet->dir);
}
@@ -84,7 +84,7 @@ void UIScene_SettingsOptionsMenu::tick()
m_multiList.AddNewCheckbox(app.GetString(IDS_VIEW_BOBBING), eControl_ViewBob, (app.GetGameSettings(m_iPad,eGameSetting_ViewBob)!=0));
m_multiList.AddNewCheckbox(app.GetString(IDS_HINTS), eControl_Hints, (app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0));
m_multiList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_DEATH_MESSAGES), eControl_DeathMessages, (app.GetGameSettings(m_iPad,eGameSetting_DeathMessages)!=0));
m_multiList.AddNewCheckbox(L"Passive chunk loading", eControl_PassiveChunkLoading, (app.GetGameSettings(m_iPad,eGameSetting_PassiveChunkLoading)!=0));
m_multiList.AddNewCheckbox(L"Passive Chunk Loading", eControl_PassiveChunkLoading, (app.GetGameSettings(m_iPad,eGameSetting_PassiveChunkLoading)!=0));
if(m_bNotInGame)
{
+1 -1
View File
@@ -45,7 +45,7 @@ void ItemFrameRenderer::render(shared_ptr<Entity> _itemframe, double x, double
float back = 0.0f;
// set offset to 1 if the item frame is not placed by the player
if (itemFrame->level->isClientSide && !itemFrame->placedByPlayer)
if (itemFrame->level->isClientSide && itemFrame->placedByTutorial)
{
back = 1.0f;
}
+4
View File
@@ -846,6 +846,10 @@ shared_ptr<Packet> TrackedEntity::getAddEntityPacket()
{
data |= 0x100;
}
if (frame->placedByTutorial)
{
data |= 0x200;
}
shared_ptr<AddEntityPacket> packet = std::make_shared<AddEntityPacket>(e, AddEntityPacket::ITEM_FRAME, data, yRotp, xRotp, xp, yp, zp);
packet->x = Mth::floor(frame->xTile * 32.0f);
packet->y = Mth::floor(frame->yTile * 32.0f);
+4
View File
@@ -16,6 +16,7 @@ AddPaintingPacket::AddPaintingPacket()
dir = 0;
motive = L"";
placedByPlayer = false;
placedByTutorial = false;
}
AddPaintingPacket::AddPaintingPacket(shared_ptr<Painting> e)
@@ -27,6 +28,7 @@ AddPaintingPacket::AddPaintingPacket(shared_ptr<Painting> e)
dir = e->dir;
motive = e->motive->name;
placedByPlayer = e->placedByPlayer;
placedByTutorial = e->placedByTutorial;
}
void AddPaintingPacket::read(DataInputStream *dis) //throws IOException
@@ -38,6 +40,7 @@ void AddPaintingPacket::read(DataInputStream *dis) //throws IOException
z = dis->readInt();
dir = dis->readInt();
placedByPlayer = dis->readByte() != 0;
placedByTutorial = dis->readByte() != 0;
}
void AddPaintingPacket::write(DataOutputStream *dos) //throws IOException
@@ -49,6 +52,7 @@ void AddPaintingPacket::write(DataOutputStream *dos) //throws IOException
dos->writeInt(z);
dos->writeInt(dir);
dos->writeByte(placedByPlayer ? 1 : 0);
dos->writeByte(placedByTutorial ? 1 : 0);
}
void AddPaintingPacket::handle(PacketListener *listener)
+1
View File
@@ -13,6 +13,7 @@ public:
int dir;
wstring motive;
bool placedByPlayer;
bool placedByTutorial;
public:
AddPaintingPacket();
+30 -1
View File
@@ -16,6 +16,7 @@ void HangingEntity::_init(Level *level)
xTile = yTile = zTile = 0;
this->heightOffset = 0;
this->setSize(0.5f, 0.5f);
placedByTutorial = false;
}
HangingEntity::HangingEntity(Level *level) : Entity( level )
@@ -69,7 +70,7 @@ void HangingEntity::setDir(int dir)
int offset = 0;
// set offset to 1 if placed in stock world
if (level->isClientSide && !placedByPlayer)
if (level->isClientSide && placedByTutorial)
{
offset = 1;
}
@@ -262,6 +263,7 @@ void HangingEntity::push(double xa, double ya, double za)
void HangingEntity::addAdditonalSaveData(CompoundTag *tag)
{
tag->putByte(L"PlacedByPlayer", placedByPlayer ? 1 : 0);
tag->putByte(L"PlacedByTutorial", placedByTutorial ? 1 : 0);
tag->putByte(L"Direction", static_cast<byte>(dir));
tag->putInt(L"TileX", xTile);
tag->putInt(L"TileY", yTile);
@@ -301,6 +303,33 @@ void HangingEntity::readAdditionalSaveData(CompoundTag *tag)
placedByPlayer = tag->getByte(L"PlacedByPlayer") == 1;
}
if (tag->contains(L"PlacedByTutorial"))
{
placedByTutorial = tag->getByte(L"PlacedByTutorial") == 1;
}
else
{
bool isTutorial = false;
Minecraft *minecraft = Minecraft::GetInstance();
if (minecraft != nullptr && minecraft->isTutorial())
{
isTutorial = true;
}
else
{
LevelGenerationOptions *levelGen = app.getLevelGenerationOptions();
if (levelGen != nullptr && levelGen->isTutorial())
{
isTutorial = true;
}
}
if (isTutorial && !placedByPlayer)
{
placedByTutorial = true;
}
}
bool hasDir = false;
if (tag->contains(L"Direction"))
{
+1
View File
@@ -21,6 +21,7 @@ public:
int dir;
int xTile, yTile, zTile;
bool placedByPlayer = false;
bool placedByTutorial = false;
HangingEntity(Level *level);
HangingEntity(Level *level, int xTile, int yTile, int zTile, int dir);
+2
View File
@@ -74,6 +74,7 @@ shared_ptr<HangingEntity> HangingEntityItem::createEntity(Level *level, int x, i
{
shared_ptr<Painting> painting = std::make_shared<Painting>(level, x, y, z, dir);
painting->placedByPlayer = true;
painting->placedByTutorial = false;
#ifndef _CONTENT_PACKAGE
if (app.DebugArtToolsOn() && auxValue > 0)
@@ -92,6 +93,7 @@ shared_ptr<HangingEntity> HangingEntityItem::createEntity(Level *level, int x, i
{
shared_ptr<ItemFrame> itemFrame = std::make_shared<ItemFrame>(level, x, y, z, dir);
itemFrame->placedByPlayer = true;
itemFrame->placedByTutorial = false;
itemFrame->setDir(dir);
return dynamic_pointer_cast<HangingEntity> (itemFrame);
+1 -1
View File
@@ -14,7 +14,7 @@ IceTile::IceTile(int id) : HalfTransparentTile(id, L"ice", Material::ice, false)
int IceTile::getRenderLayer()
{
return 2;
return 1;
}
bool IceTile::shouldRenderFace(LevelSource *level, int x, int y, int z, int face)