feat: more item work
This commit is contained in:
1 parent
4e614c9eeb
commit
3a3ba2c873
110 files changed
+5501
-817
No files matched your search
@@ -29,8 +29,15 @@ impl BlockEntity for CreakingHeartBlockEntity {
|
||||
Self: Sized,
|
||||
{
|
||||
let creaking_uuid = nbt
|
||||
.get_string("creaking_uuid")
|
||||
.and_then(|uuid_str| Uuid::parse_str(uuid_str).ok());
|
||||
.get_uuid("creaking")
|
||||
.or_else(|| {
|
||||
nbt.get_string("creaking")
|
||||
.and_then(|uuid_str| Uuid::parse_str(uuid_str).ok())
|
||||
})
|
||||
.or_else(|| {
|
||||
nbt.get_string("creaking_uuid")
|
||||
.and_then(|uuid_str| Uuid::parse_str(uuid_str).ok())
|
||||
});
|
||||
Self {
|
||||
position,
|
||||
creaking_uuid: AtomicCell::new(creaking_uuid),
|
||||
@@ -39,10 +46,18 @@ impl BlockEntity for CreakingHeartBlockEntity {
|
||||
|
||||
fn write_nbt(&self, nbt: &mut NbtCompound) {
|
||||
if let Some(uuid) = self.creaking_uuid.load() {
|
||||
nbt.put_string("creaking_uuid", uuid.to_string());
|
||||
nbt.put_uuid("creaking", uuid);
|
||||
}
|
||||
}
|
||||
|
||||
fn chunk_data_nbt(&self) -> Option<NbtCompound> {
|
||||
let mut nbt = NbtCompound::new();
|
||||
if let Some(uuid) = self.creaking_uuid.load() {
|
||||
nbt.put_uuid("creaking", uuid);
|
||||
}
|
||||
Some(nbt)
|
||||
}
|
||||
|
||||
fn as_any(&self) -> &dyn std::any::Any {
|
||||
self
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user