Skip to content

Commit 8567c65

Browse files
committed
CompoundTag: repeat 3e0d9ef for 0.2 legacy
1 parent 5073419 commit 8567c65

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tag/CompoundTag.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,12 @@ public function read(NBTStream $nbt, ReaderTracker $tracker) : void{
331331
$tag = $nbt->readTag($tracker);
332332
if($tag !== null){
333333
if(isset($this->value[$tag->__name])){
334-
throw new \UnexpectedValueException("Duplicate key \"$tag->__name\"");
334+
//this is technically a corruption case, but it's very common on older PM worlds (pretty much every
335+
//furnace in PM worlds prior to 2017 is affected), and since we can't extricate this borked data
336+
//from the rest in Anvil/McRegion worlds, we can't barf on this - it would result in complete loss
337+
//of the chunk.
338+
//TODO: add a flag to enable throwing on this (strict mode)
339+
continue;
335340
}
336341
$this->value[$tag->__name] = $tag;
337342
}

0 commit comments

Comments
 (0)