Fix summoned Crafting Blueprint entities corrupting the world

This commit is contained in:
reidbhuntley 2021-12-22 21:14:02 -05:00
parent fa22830b04
commit bf59956f23

View file

@ -7,6 +7,8 @@ import java.util.Optional;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.minecraft.nbt.Tag;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import com.simibubi.create.AllEntityTypes; import com.simibubi.create.AllEntityTypes;
@ -113,9 +115,15 @@ public class BlueprintEntity extends HangingEntity
@Override @Override
public void readAdditionalSaveData(CompoundTag p_70037_1_) { public void readAdditionalSaveData(CompoundTag p_70037_1_) {
if (p_70037_1_.contains("Facing", Tag.TAG_ANY_NUMERIC)) {
this.direction = Direction.from3DDataValue(p_70037_1_.getByte("Facing")); this.direction = Direction.from3DDataValue(p_70037_1_.getByte("Facing"));
this.verticalOrientation = Direction.from3DDataValue(p_70037_1_.getByte("Orientation")); this.verticalOrientation = Direction.from3DDataValue(p_70037_1_.getByte("Orientation"));
this.size = p_70037_1_.getInt("Size"); this.size = p_70037_1_.getInt("Size");
} else {
this.direction = Direction.SOUTH;
this.verticalOrientation = Direction.DOWN;
this.size = 1;
}
super.readAdditionalSaveData(p_70037_1_); super.readAdditionalSaveData(p_70037_1_);
this.updateFacingWithBoundingBox(this.direction, this.verticalOrientation); this.updateFacingWithBoundingBox(this.direction, this.verticalOrientation);
} }