mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-28 03:22:58 +00:00
Use fixed-width byte values in world data
This commit is contained in:
parent
52eb80c3eb
commit
9d41d3c359
|
|
@ -13,8 +13,8 @@ SkullTileEntity::SkullTileEntity()
|
|||
void SkullTileEntity::save(CompoundTag *tag)
|
||||
{
|
||||
TileEntity::save(tag);
|
||||
tag->putByte(L"SkullType", (BYTE) (skullType & 0xff));
|
||||
tag->putByte(L"Rot", (BYTE) (rotation & 0xff));
|
||||
tag->putByte(L"SkullType", static_cast<std::uint8_t>(skullType & 0xff));
|
||||
tag->putByte(L"Rot", static_cast<std::uint8_t>(rotation & 0xff));
|
||||
tag->putString(L"ExtraType", extraType);
|
||||
}
|
||||
|
||||
|
|
@ -69,4 +69,4 @@ std::shared_ptr<TileEntity> SkullTileEntity::clone()
|
|||
result->rotation = rotation;
|
||||
result->extraType = extraType;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1097,7 +1097,7 @@ void Mob::addAdditonalSaveData(CompoundTag *entityTag)
|
|||
MobEffectInstance *effect = it->second;
|
||||
|
||||
CompoundTag *tag = new CompoundTag();
|
||||
tag->putByte(L"Id", (BYTE) effect->getId());
|
||||
tag->putByte(L"Id", static_cast<std::uint8_t>(effect->getId()));
|
||||
tag->putByte(L"Amplifier", (char) effect->getAmplifier());
|
||||
tag->putInt(L"Duration", effect->getDuration());
|
||||
listTag->add(tag);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void TileUpdatePacket::read(DataInputStream *dis) //throws IOException
|
|||
|
||||
block = (int)dis->readShort() & 0xffff;
|
||||
|
||||
BYTE dataLevel = dis->readByte();
|
||||
std::uint8_t dataLevel = dis->readByte();
|
||||
data = dataLevel & 0xf;
|
||||
levelIdx = (dataLevel>>4) & 0xf;
|
||||
#else
|
||||
|
|
@ -61,7 +61,7 @@ void TileUpdatePacket::write(DataOutputStream *dos) //throws IOException
|
|||
dos->writeInt(z);
|
||||
dos->writeShort(block);
|
||||
|
||||
BYTE dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf);
|
||||
std::uint8_t dataLevel = ((levelIdx & 0xf ) << 4) | (data & 0xf);
|
||||
dos->writeByte(dataLevel);
|
||||
#else
|
||||
// 4J - for our fixed size map, we can pack x & z into 10 bits each (-512 -> 511), y into 8 bits (0 to 255)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ DesertBiome::DesertBiome(int id) : Biome(id)
|
|||
friendlies.clear();
|
||||
friendlies_chicken.clear(); // 4J added
|
||||
friendlies_wolf.clear(); // 4J added
|
||||
this->topMaterial = (BYTE) Tile::sand_Id;
|
||||
this->material = (BYTE) Tile::sand_Id;
|
||||
this->topMaterial = static_cast<std::uint8_t>(Tile::sand_Id);
|
||||
this->material = static_cast<std::uint8_t>(Tile::sand_Id);
|
||||
|
||||
decorator->treeCount = -999;
|
||||
decorator->deadBushCount = 2;
|
||||
|
|
@ -30,4 +30,4 @@ void DesertBiome::decorate(Level *level, Random *random, int xo, int zo)
|
|||
Feature *well = new DesertWellFeature();
|
||||
well->place(level, random, x, level->getHeightmap(x, z) + 1, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue